Skip to content

Instantly share code, notes, and snippets.

@alexpghayes
Created July 15, 2017 20:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexpghayes/1db75a882d591f4705e51f2c65ff17ca to your computer and use it in GitHub Desktop.
Save alexpghayes/1db75a882d591f4705e51f2c65ff17ca to your computer and use it in GitHub Desktop.
#tidyeval question for Hadley
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