Filter multiple values in tidyverse

rstudio

#1

Hello,
I cannot filter multiple things.
Why?

df6a3 <- df6 %>% 
+   group_by(category, PROGRAM_LEVEL_DESCR) %>% 
+   filter(PROGRAM_LEVEL_DESCR == c("Club","Diamond"))
Error in filter_impl(.data, quo) : Result must have length 1, not 2
In addition: There were 14 warnings (use warnings() to see them)

#2

Try this:

df6a3 <- df6 %>% 
group_by(category, PROGRAM_LEVEL_DESCR) %>% 
filter(PROGRAM_LEVEL_DESCR %in% c("Club","Diamond"))

You might want to filter before grouping though.


#3

Martin:
Thank you.
And I will do that!