Skip to content

Function Generation #2

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions