friendlyeval (version 0.1.1)

treat_inputs_as_cols: treat_inputs_as_cols

Description

Take the literal text input for a comma separated list of arguments and treat it as list of column names in a dplyr function.

Usage

treat_inputs_as_cols(...)

Arguments

...

a comma separated list of arguments to be treated as column names.

Value

something that will resolve to a list of column names when prefixed with `!!!`

Details

The most common usage of this is to pass `...`, from your function directly through to dplyr functions as column names, as in the `select_these` example.

This function must be prefixed with `!!!` to treat the output as a list.

Examples

Run this code
# NOT RUN {
select_these <- function(dat, ...){
 select(dat, !!!treat_inputs_as_cols(...))
}
select_these(mtcars, cyl, wt)
# }

Run the code above in your browser using DataLab