I want to filter a dataset with a column not like any value in a list
I tried different ways but they don't work
month <- c("2022-02", "2022-02", "2022-03", "2022-03", "2022-05","2022-06", "2022-07","2022-02", "2022-04","2022-5","2022-6","2022-7")
total_amount <- c(100, 200, 500, 600, 700, 300, 500, 900, 900, 600, 500, 700)
merchant_name <- c("fpay", "gpay", "upay", "zpay","tpay","spay","mpay", "dpay", "bpay", "opay", "npay", "ypay")
df <- data.frame(month, total_amount, merchant_name)
a <- c("fpay", "gpay", "upay", "zpay","tpay","spay","mpay")
df1 = df %>% list.filter(!merchant_name %like% a)
or
df1 = subset(df, !merchant_name%like% a)
or
df1 <- df[apply(df,1,function(x) sum(!x %like% a)>=1),]
However, the number of observations of df1 is the same to df's, not filter at all. And I receive a warning message:
In grepl(pattern, vector, ignore.case = ignore.case, fixed = fixed) : argument 'pattern' has length > 1 and only the first element will be used
Please kindly help me. Thanks a lot