[R] How to delete Identical columns
Charles Berry
ccberry at ucsd.edu
Thu Mar 28 17:25:54 CET 2013
Charles Berry <ccberry <at> ucsd.edu> writes:
[snip]
>
> Katherine Gobin <katherine_gobin <at> yahoo.com> writes:
> > 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.
>
My bad. Mea culpa, etc.
There is a data.frame method, but it ignores the MARGIN arg.
Better to stick with what David suggested:
http://article.gmane.org/gmane.comp.lang.r.general/289881
HTH,
More information about the R-help
mailing list