[R] Removing not duplicated rows

From: Chris82 <rubenbauar_at_gmx.de>
Date: Fri, 08 Apr 2011 08:07:20 -0700 (PDT)

Hello R users,

I have a problem to delete rows in a table which are not duplicated in order of an id number

a short example:

x <- data.frame(cbind(id=c(1,2,2,2,3,3,4,5,6,6), value=1:10))

x_new <- x[which(duplicated(x$id)),]

> x_new

   id value

3   2     3
4   2     4
6   3     6

10 6 10

The problem is that my command not only delet the id number which occur only one time.
Also the first row with the id number (2,3 and 6 is deleted).


With best regards

View this message in context: http://r.789695.n4.nabble.com/Removing-not-duplicated-rows-tp3436600p3436600.html
Sent from the R help mailing list archive at Nabble.com.

R-help_at_r-project.org mailing list
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:10:50 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:40: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