Imagine I have a dataset as follows
d <- data.frame(a = 1:10, b = letters[1:10], c = sample(10))
Imagine that I also have a character vector containing variable names
v <- c("a", "b")
Using dplyr
I would like to use v
to select
variables a
& b
.
This will not work,
d %>%
select(v)
This is because the dplyr
packages uses non standard evaluation and expects actual variable names to be passed rather then characters.