[R] removing duplicate rows

Sean Anderson sc2ander at xcskier.com
Wed May 12 02:28:48 CEST 2010

On Tue, May 11, 2010 at 9:07 PM, Jim Bouldin <jrbouldin at ucdavis.edu> wrote:
> I'm trying to identify and remove rows in a data frame that are duplicated
> only on particular columns within it (i.e. not on all columns).

This is probably the cleanest way:

dat <- data.frame(x = c(1, 2, 3), y = c(1, 1, 3))
subset(dat, !duplicated(y))

See this thread (among others) for some other options:

More information about the R-help mailing list