df = data.frame(aaa = c(1, 2, 3),
bbb = c('b', 'c', 'd'),
ccc = c(5, 6, 7))
column_to_filter = 'bbb'
list_bbb_values_to_filter_rows = as.data.frame(c('b', 'c')) |> pull.()
# Wrong code -- results in empty dataframe
df |> filter.(!!!column_to_filter %in% list_bbb_values_to_filter_rows)
What I would like as a result is
aaa bbb ccc
3 d 7
I tried using only one !
but the problem is
Warning message:
In if (!is.na(list_customers_filter)) { :
the condition has length > 1 and only the first element will be used
I also tried sym()
without much luck, and I also tried {{}}
df |> filter.(!{{column_to_filter}} %in% list_bbb_values_to_filter_rows)
and I would like to use all of the elements as filter. How can I filter properly?