Skip to content

Instantly share code, notes, and snippets.

@ramhiser
Last active August 29, 2015 14:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramhiser/11270663 to your computer and use it in GitHub Desktop.
Save ramhiser/11270663 to your computer and use it in GitHub Desktop.
Filters out groups in data.frame having less than a specified number of observations
library(dplyr)
group_size <- 20
foo <- iris[1:119, ]
filter(group_by(foo, Species), n() >= group_size)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment