Tomas H Tomas H - 1 year ago 116
R Question

How to keep only groups above certain number of rows?



So when you run this script you will get output below. Now in cut and color column there are just 3 combinations " Fair D" which is also possible to see from rank1 column. Another group " Fair E" has 5 rows. I want to keep just rows for groups with more than 3 rows .

enter image description here

Answer Source

We can use filter with a logical condition (n() > 3) to keep only groups that have number of rows greater than a particular value

data %>% 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download