I have a column in my data frame in which every row is a list. Is it possible to remove certain values from the column by exclusion?
I have tried the following approach for vectors:
yelp_asian_final %>% mutate(categories = ifelse(categories != "Thai" | categories != "Vietnamese", NULL,
categories))
But I got the following error:
Error in mutate_impl(.data, dots) :
Evaluation error: replacement has length zero.
In addition: Warning message:
In rep(yes, length.out = length(ans)) :
'x' is NULL so the result will be NULL
Example of the first 4 rows:
> dput(head(yelp_asian_final$categories,4)
+ )
list(c("Thai", "Restaurants"), c("Vietnamese", "Restaurants"),
c("Indian", "Restaurants"), c("Restaurants", "Japanese",
"Sushi Bars"))