[R] Removing not duplicated rows

Jeremy Hetzel jthetzel at gmail.com
Fri Apr 8 17:24:48 CEST 2011


Sorry, I left out the names() function in the last step.

Try this instead:
x <- data.frame(cbind(id=c(1,2,2,2,3,3,4,5,6,6), value=1:10))
id.table <- table(x$id)
x_new <- subset(x, id %in% names(id.table[id.table > 1]))

Jeremy


More information about the R-help mailing list