For the following scenario I get an empty data frame
D = data.frame(X = c("x1", "x2", "x3"))
vals = c("x1", "x2")
col = "X"
dplyr::filter(D, col %in% vals)
But doing it as following works
dplyr::filter(D, X %in% vals)
I cannot hardcode the name of the column nor the values by which to filter. I need the first scenario to work.