Skip to content

Instantly share code, notes, and snippets.

@pbaylis
Created May 27, 2019 18:35
Show Gist options
  • Select an option

  • Save pbaylis/4caa0b928a5c56ce6c8f56a4e58c08d1 to your computer and use it in GitHub Desktop.

Select an option

Save pbaylis/4caa0b928a5c56ce6c8f56a4e58c08d1 to your computer and use it in GitHub Desktop.

Revisions

  1. pbaylis created this gist May 27, 2019.
    4 changes: 4 additions & 0 deletions dynamic-var-names-dplyr.R
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    multipetal <- function(df, n) {
    varname <- paste("petal", n , sep=".")
    mutate(df, !!varname := Petal.Width * n)
    }