shbrainard
shbrainard

Reputation: 387

R calling non-unique values duplicates

I have the following csv file as dataframe called key: https://www.dropbox.com/s/vy7bxlh2oyvh141/key.csv?dl=0

When I run:

dup <- key[which(duplicated(key$Genotype)), ]

I get a dataframe with 100 rows, most of actually appear unique:

> head(dup)
       Pot  Genotype
193 142698 PI-177384
194 142700 PI-178900
195 142702 PI-179275
196 142704 PI-179276
197 142706 PI-179277
198 142712 PI-179690

Does anyone know the reason for this?

Upvotes: 0

Views: 644

Answers (1)

Matt
Matt

Reputation: 7413

If you want to create a df of duplicated rows, you'll have to alter the code to include a !

This should work:

dup <- key[which(!duplicated(key$Genotype)), ]

Upvotes: 1

Related Questions