Created
July 15, 2017 20:47
-
-
Save alexpghayes/1db75a882d591f4705e51f2c65ff17ca to your computer and use it in GitHub Desktop.
#tidyeval question for Hadley
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
library(tidyverse) | |
library(rlang) | |
f <- function(x, c) c * x | |
col_names <- c("am", "gear", "carb") | |
exprs <- purrr::map(col_names, ~quo(!!paste0("c_", .x) := f(!!sym(.x), 3))) | |
mutate(mtcars, !!!exprs) | |
# Error in mutate_impl(.data, dots) : Column ``:=`("c_am", f(am, 3))` is of unsupported type quoted call |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment