Consider
df = data.frame(col1 = 1:3, col2 = 2:4)
I want to do
df %>%
filter(col1 %in% 2:3)
which should return the 2nd and 3rd row, but col1
is passed in as a string as variable str_1 = "col1"
So I tried
str_1 = "col1"
df %>%
filter(!!!str_1 %in% 2:3)
df %>%
filter(!!str_1 %in% 2:3)
and niether worked. What's the right syntax for this? And what's an easier way to remember these dplyr tricks?