Re: [R] Removing not duplicated rows

From: Jeremy Hetzel <jthetzel_at_gmail.com>
Date: Fri, 08 Apr 2011 08:22:30 -0700 (PDT)


As I understand it, you are trying to subset the data frame to include only rows with a non-unique id.

Try this:
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% id.table[id.table > 1])

Jeremy



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri 08 Apr 2011 - 15:25:53 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 08 Apr 2011 - 15:50:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive