Hi,
Try this:
#Duplicated:
x<-c(1:3,3)
x==x[duplicated(x)]
#[1] FALSE FALSE? TRUE? TRUE
#Unique:
?x[!x==x[duplicated(x)]]
#[1] 1 2
A.K.
----- Original Message -----
From: Nico902 <descostes at ciml.univ-mrs.fr>
To: r-help at r-project.org
Cc:
Sent: Monday, July 9, 2012 12:42 PM
Subject: [R] unique vs duplicate problem
Hi,
Let say I have a numeric vector:? x <- c(1, 2, 3, 3).
I want on one hand numbers which are not duplicated ie "1,2" and duplicated
"3".
so I did:
duplicated(x)
FALSE FALSE FALSE TRUE
unique(x)
1 2 3
which is not what I want. Is there a function in R to have the following
result: