I have a dataframe and I would like to count the number of rows within each group. I reguarly use the aggregate function to sum data as follows:
aggregate
If your trying the aggregate solutions above and you get the error:
invalid type (list) for variable
Because you're using date or datetime stamps, try using as.character on the variables:
aggregate(x ~ as.character(Year) + Month, data = df, FUN = length)
On one or both of the variables.