Created
August 26, 2015 21:15
-
-
Save fredbenenson/72bf3e6c85fef5310d4b to your computer and use it in GitHub Desktop.
metaprogramming dplyr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dataframe %>% parse(text = paste(sapply(dimensions, function(dimension) { | |
paste0("mutate(", paste0(dimension, "_average = mean(", dimension, "))")) | |
}), collapse = " %>% ")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Figured it out: