Here is solution using function ddply() from library plyr
ddply()
plyr
library(plyr) ddply(df,.(a,b),nrow) a b V1 1 1 2.5 1 2 1 3.5 2 3 2 2.0 2 4 3 1.0 1 5 4 2.2 1 6 4 7.0 1
2.1m questions
2.1m answers
60 comments
57.0k users