The vote column in the dataset has a number that represents that country's vote:
vote
# Filter for votes that are "yes", "abstain", or "no" votes %>% filter(vote <=3)
What if I use:
# Filter for votes that are "yes", "abstain", or "no" votes %>% filter(vote == c(1,2,3))
A different result. What's this?
I'm guessing you have a column which is numeric and not a list-column. So none of the rows have a value of c(1, 2, 3) so none will be that value, you want to use %in% and not ==. If your data is as you say, the following are equivalent:
c(1, 2, 3)
%in%
==
votes %>% filter(vote <=3) votes %>% filter(vote %in% c(1, 2, 3)) votes %>% filter(vote %in% 1:3)
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.