r - how to use select for multiple fields using dplyr -


i have character vector of field names want select using dplyr. i'm using underscore version of select_().

select(mtcars, mpg)                   # works ok select(mtcars, mpg, disp, am)         # works ok multiple fields 

now let's use underscore version

fie <- c("mpg")              select_(mtcars, fie)                  # works ok 1 fie <- c("mpg", "disp", "am") select_(mtcars, fie)                  # problem:  returns 1 column select_(mtcars, ~fie)                 # problem:  doesn't work 

i'm confused how work. suggestions?

if use select:

select(mtcars, one_of(fie)) 

Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -