I have two columns in data frame
2010 1 2010 1 2010 2 2010 2 2010 3 2011 1 2011 2
I want to count frequency of both columns and get the result in this format
y m Freq 2010 1 2 2010 2 2 2010 3 1 2011 1 1 2011 2 1
If your data is dataframe df with columns y and m
df
y
m
library(plyr) counts <- ddply(df, .(df$y, df$m), nrow) names(counts) <- c("y", "m", "Freq")
1.4m articles
1.4m replys
5 comments
57.0k users