Count number of rows within each group Current best practice (tidyverse) is: require(dplyr) df1 %>% count(Year, Month)