[R] How to delete Identical columns

Charles Berry ccberry at ucsd.edu
Thu Mar 28 16:40:05 CET 2013


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,



More information about the R-help mailing list