This is a follow up of this question. How can I filter all participants (in this case, schools) that matches ALL factors in my desired subset ? Not one or another.
edit = subset was up to Level 04 (1 up to 4), not Level 05
my dataframe looks like this:
quest40_2[1:10,]
# A tibble: 10 x 4
SCHOOL Q9 Q11 Q40
<glue> <fct> <fct> <fct>
1 School1 typeB level0 NA
2 School1 typeB level01 NA
3 School1 typeB level02 NA
4 School1 typeB level03 NA
5 School1 typeB NA plan1_level0upto02
6 School1 typeB NA plan2_level_03
7 School1 typeB NA plan3_level_04
8 School2 typeB level01 NA
9 School2 typeB level02 NA
10 School2 typeB level03 NA
- edit for clarification: desired output:
A tibble: 12 x 4
SCHOOL Q9 Q11 Q40
<glue> <fct> <fct> <fct>
1 School2 typeB level01 NA
2 School2 typeB level02 NA
3 School2 typeB level03 NA
4 School2 typeB level04 NA
5 School3 typeB level01 NA
6 School3 typeB level02 NA
7 School3 typeB level03 NA
8 School3 typeB level04 NA
9 School5 typeC level01 NA
10 School5 typeC level02 NA
11 School5 typeC level03 NA
12 School5 typeC level04 NA
Question I want to subset all
SCHOOLs
that have level01, level02 level03 AND level04 inQ11
levels (such as the operator &&, for example). Hence, I cannot have schools that offer one of them, but not all. Any ideas?(preferably,tidyverse
ones)data is in the linked post above