Skip to content
Prev 278186 / 398506 Next

Removing rows in dataframe w'o duplicated values

one approach is the following:

dat <- data.frame(id = c(1,1,1,2,3,3), value = c(5,6,7,4,5,4),
     value2 = c(1,4,3,3,4,3))

ind <- ave(dat$id, dat$id, FUN = length) > 1
dat[ind, ]


I hope it helps.

Best,
Dimitris
On 11/22/2011 6:43 PM, AC Del Re wrote: