[R] Extracting only multiple occurrences

David Winsemius dwinsemius at comcast.net
Thu Aug 8 08:03:44 CEST 2013


On Aug 7, 2013, at 10:37 PM, Kevin Parent wrote:

> Hoping someone here can help me with this small problem.
> set.seed(2013)
> 
> x<-sort(c(letters,letters[sample(26,10,1)]))
> 
> This gives a vector of 36 letters with some muliples (in this case, g,m,s,t,u,v,x,y). Now what I need is to get rid of the ones that only occur once and keep the multiples. I need the opposite of the unique() function. I expect this should be pretty easy but I can't see it. Anyone know a solution? Thanks in advance!
> 
> 
?duplicated

x[ duplicated(x) ]


David Winsemius
Alameda, CA, USA



More information about the R-help mailing list