Find how many times duplicated rows repeat in R data frame [duplicate]

Here is solution using function ddply() from library 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

Leave a Comment