[R] How to get the duplicated elements from a vector?

Leon Yee yee.leon at gmail.com
Wed Oct 29 15:19:54 CET 2008


Gustaf Rydevik wrote:
> Hi Leon,
> 
> unique(x)
> 
> or
> 
> duplicated(x)
> 
> should work, depending on what you want.
> 
> Best,
> 
> Gustaf
> 

Hi,
    Thank you all. Actually, I have a data frame or matrix, whose first 
column is numerical values, and whose 2nd column is names. I need those 
whose names repeated 3 times and get the mean of the 3 values for each 
repeated names.

    It sounds that I need some programming work.

Regards,
Leon



More information about the R-help mailing list