Skip to content

Function Generation #2

@ashbaldry

Description

@ashbaldry

From @ramiromagno:

Besides providing code, auto-generate a parameterized function:

repro_function(summary_tbl)
# Returns:
function(min_width = 1.5, summary_fn = "mean") {
  iris_filt <- iris[iris$Petal.Width > min_width, ]
  stats::aggregate(
    Sepal.Width ~ Species,
    data = iris_filt,
    FUN = get(summary_fn)
  )
}

Benefits:

  • Users can vary inputs without re-running the app
  • Fully qualified calls (stats::) remove dependency management
  • Default values show what the app used
  • Immediately callable and composable

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions