2

I'm trying to use R to delete all the duplicate values without keeping the original value.

For example I've the following list

 1. Car 
 2. Car
 3. Food 

Unique function will remove the the duplicate and will keep the original.

 1. Car 
 2. Food 

I need to to remove all the duplicate values and to get only the value that occurred once.

1. Food

Thank you in advance

Psidom
  • 209,562
  • 33
  • 339
  • 356
Ammar
  • 43
  • 8

1 Answers1

3

We can use

df1[!(duplicated(df1$col)|duplicated(df1$col, fromLast=TRUE)),, drop=FALSE]
#   col
#3. Food
akrun
  • 874,273
  • 37
  • 540
  • 662