Try this: DF[!duplicated(DF[-2]),]
On Thu, Apr 22, 2010 at 10:05 PM, chrisli1223 <chri...@austwaterenv.com.au> wrote: > > Hi all, > > I have a dataset similar to the following > > Name Date Value > A 1/01/2000 4 > A 2/01/2000 4 > A 3/01/2000 5 > A 4/01/2000 4 > A 5/01/2000 1 > B 6/01/2000 2 > B 7/01/2000 1 > B 8/01/2000 1 > > I would like R to remove duplicates based on column 1 and 3 only. In > addition, I would like R to remove duplicates based on the underlying and > overlying row only. For example, for A, I would like to remove row 2 only > and keep row 1, 3 and 4. > > I have tried: unique() and replicated(), but I do not have much success. I > have also tried: dataset<-c(1,diff(dataset)!=0), but I don't know how to > apply it to this multi-column situation. > > Any help would be greatly appreciated. > > Thanks in advance, > Chris > -- > View this message in context: > http://r.789695.n4.nabble.com/Remove-duplicated-rows-tp2023065p2023065.html > Sent from the R help mailing list archive at Nabble.com. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. > ______________________________________________ R-help@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.