What is the best way to filter a data.frame to only get groups of say size 5?
So my data looks as follows:
require(dplyr) n <- 1e5 x <- rnorm(n
You can do it more concisely with n():
n()
library(dplyr) dat %>% group_by(cat) %>% filter(n() == 5)