Reputation: 2513
library(dplyr)
specials <- names(mtcars)[1:2]
specials[1]
i=1
setup is complete, this works...
mtcars %>%
select_(specials[i], ~gear, ~carb)
why does the nse fail on adding the filter?
mtcars %>%
select_(specials[i], ~gear, ~carb) %>%
filter_(specials[i] == 21.4)
Upvotes: 0
Views: 107
Reputation: 887108
We may need the interp
library(lazyeval)
library(dplyr)
mtcars %>%
select_(specials[i], ~gear, ~carb) %>%
filter_(interp(~nm == 21.4, nm = as.name(specials[1])))
# mpg gear carb
#1 21.4 3 1
#2 21.4 4 2
Upvotes: 1