s-news
[Top] [All Lists]

review of duplicate values handling

To: "'S-news@wubios.wustl.edu'" <S-news@wubios.wustl.edu>
Subject: review of duplicate values handling
From: Stafford Phillip-APS095 <phillip.stafford@motorola.com>
Date: Fri, 21 Dec 2001 16:53:40 -0600
Thanks to all who responded to the question of how to get ALL duplicated 
elements instead of the subsequent ones, as usual there are some great general 
methods summarized here:

Bert Gunter reminded me of how powerful is.element and match() are:
is.element(x,x[duplicated(x)])


Tom Jagger provided a function that gives you all duplicated elements:

all.dup <- function(x)
           {
               dups<-duplicated(x) 
               return( is.element( x, unique(x[duplicated(x)]) ) ) 
             }

Tim Hesterberg:  making non-unique row names is pretty handy, the key is:
data.frame(..., row.names=row.names(...),dup.row.names=T)       (this is worth 
the price of admission alone)


Bert, Tim, Myong-Hee Sung all suggested:
is.element(x, duplicated(x))


Thanks to all who responded, it's been a great present.


Sincerely;

Phillip

<Prev in Thread] Current Thread [Next in Thread>
  • review of duplicate values handling, Stafford Phillip-APS095 <=