duplicated()
> test.df
V1 V2 V3 V4 V5 V6 V7
1 -115.380 32.894 195 162.940 D 8419 D
2 -115.432 32.864 115 208.910 D 8419 D
3 -115.447 32.773 1170 264.570 D 8419 D
4 -115.447 32.773 1170 264.570 D 8419 D
5 -115.447 32.773 1170 264.570 D 8419 D
6 -115.447 32.773 1170 264.570 D 8419 D
7 -115.447 32.773 149 186.210 D 8419 D
8 -115.466 32.855 114 205.630 D 8419 D
9 -115.473 32.800 1121 207.469 D 8419 D
> test.df[!duplicated(test.df),]
V1 V2 V3 V4 V5 V6 V7
1 -115.380 32.894 195 162.940 D 8419 D
2 -115.432 32.864 115 208.910 D 8419 D
3 -115.447 32.773 1170 264.570 D 8419 D
7 -115.447 32.773 149 186.210 D 8419 D
8 -115.466 32.855 114 205.630 D 8419 D
9 -115.473 32.800 1121 207.469 D 8419 D
On 24-Aug-09, at 11:23 AM, Mehdi Khan wrote:
> Hello everyone, when I run the "unique" command on my data frame,
> it deletes
> the majority of duplicate rows, but not all of them. Here is a
> sample of my
> data. How do I get it to delete all the rows?
>
> 6 -115.38 32.894 195 162.94 D 8419 D
>
> 7 -115.432 32.864 115 208.91 D 8419 D
>
> 8 -115.447 32.773 1170 264.57 D 8419 D
>
> 9 -115.447 32.773 1170 264.57 D 8419 D
>
> 10 -115.447 32.773 1170 264.57 D 8419 D
>
> 11 -115.447 32.773 1170 264.57 D 8419 D
>
> 12 -115.447 32.773 149 186.21 D 8419 D
>
> 13 -115.466 32.855 114 205.63 D 8419 D
>
> 14 -115.473 32.8 1121 207.469 D 8419 D
>
>
> Thanks a bunch!
>
> Mehdi Khan
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
Don McKenzie, Research Ecologist
Pacific WIldland Fire Sciences Lab
US Forest Service
Affiliate Professor
School of Forest Resources, College of the Environment
CSES Climate Impacts Group
University of Washington
desk: 206-732-7824
cell: 206-321-5966
dmck at u.washington.edu
donaldmckenzie at fs.fed.us