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
|