[R] duplicates including first occurrence

Knut Krueger rhe|p @end|ng |rom krueger-|@m||y@de
Mon Jan 28 12:43:15 CET 2019


Ho to all

i get the  results

mtcars[duplicated(mtcars$wt,fromLast=TRUE),]
Hornet Sportabout 18.7   8 360.0 175 3.15 3.44 17.02  0  0    3    2
Duster 360        14.3   8 360.0 245 3.21 3.57 15.84  0  0    3    4
Merc 280          19.2   6 167.6 123 3.92 3.44 18.30  1  0    4    4


mtcars[duplicated(mtcars$wt),]

Merc 280      19.2   6 167.6 123 3.92 3.44 18.3  1  0    4    4
Merc 280C     17.8   6 167.6 123 3.92 3.44 18.9  1  0    4    4
Maserati Bora 15.0   8 301.0 335 3.54 3.57 14.6  0  1    5    8


The first occurrence is missing - is there any possibility to get

Hornet Sportabout 18.7   8 360.0 175 3.15 3.44 17.02  0  0    3    2
Merc 280          19.2   6 167.6 123 3.92 3.44 18.30  1  0    4    4
Merc 280C         17.8   6 167.6 123 3.92 3.44 18.90  1  0    4    4
Duster 360    14.3   8  360 245 3.21 3.57 15.84  0  0    3    4
Maserati Bora 15.0   8  301 335 3.54 3.57 14.60  0  1    5    8


Kind regards Knut



More information about the R-help mailing list