Consider a simple function for converting unquoted names to a list of strings character vector:
fun <- function(...) {
return(sapply(rlang::ensyms(...), rlang::as_string))
}
> fun(abc, def)
"abc" "def"
Question: How can I write a similar function that takes a list of unquoted names instead of using ellipsis (...)?
foo <- function(x) {
return(???)
}
> foo(list(abc, def))
"abc" "def"
Edit: The use of rlang::ensyms is relevant, since I want the function to "throw an error when the defused expressions are not simple symbols".