count number of rows in a data frame in R based on group [duplicate]

The count() function in plyr does what you want:

library(plyr)

count(mydf, "MONTH-YEAR")

Leave a Comment