Katherine Gobin <katherine_gobin <at> yahoo.com> writes:

> 
> Dear R forum
> 
> Suppose I have a data.frame 
> 

Say.

[snip]

> How to automatically identify and retain only one column (in this example
column x) among the identical
> columns besides other non-identical columns (viz. id, y and z).


See 

?unique

Details

This is a generic function with methods for vectors, *data frames* and ...

[emphasis added]

So,

   unique( df, MARGIN=2 )

is what you want.

HTH,

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to