library(tidyverse)
data<-diamonds%>%group_by(cut,color,clarity)%>%
summarize(aver=round(mean(price),0),count=n())%>%
filter(count>10)%>%
mutate(rank1=min_rank(desc(aver)),rank2=cume_dist(desc(aver)))
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 .