r-lib / rlang

Low-level API for programming with R
https://rlang.r-lib.org
Other
508 stars 138 forks source link

Extracting expressions as strings from list of quosures #121

Closed kevinykuo closed 7 years ago

kevinykuo commented 7 years ago

Is there a cleaner way to do this?

fun1 <- function(...) rlang::dots_quos(...)

fun1(iris, mtcars) %>% 
  sapply(function(x) x %>%
           deparse() %>%
           gsub("~", "", .))
# "iris" "mtcars" 
lionel- commented 7 years ago

map_chr(exprs(...), as_string)

Note that issues are for bugs and feature requests.

hadley commented 7 years ago

Not that there's really a better place to ask these questions...

lionel- commented 7 years ago

maybe I should subscribe to a tidyeval tag on stack overflow?

lionel- commented 7 years ago

I have now subscribed to the tidyeval tag on all stack exchange sites and will receive email notifications.

kevinykuo commented 7 years ago

@lionel- Thanks! This will be helpful.

Also, in case anyone searches for this issue in the future, see ?quo_name

kevinykuo commented 7 years ago

@lionel- Getting the following on SO... Creating the new tag 'tidyeval' requires at least 1500 reputation. Try something from the existing tags list instead.

lionel- commented 7 years ago

I don't have that much rep either :/

hadley commented 7 years ago

If you point me to a question that needs tagging, I can create it

kevinykuo commented 7 years ago

@hadley http://stackoverflow.com/questions/43806854/capturing-expressions-in-dots