[R] Eliminating columns that sum to zero

Ben Bolker bolker at ufl.edu
Sun Aug 24 18:54:31 CEST 2008



Wade Wall <wade.wall <at> gmail.com> writes:

> I am trying to look for a way to eliminate columns that sum to zero. Any
> help would be appreciated.

 x_without_zero_cols <- x[,colSums(x)!=0]

  If you want to make some return for this helpful advice,
you could take this information and add it to the "R tips" section
of the R wiki ( http://wiki.r-project.org ).

  cheers
    Ben Bolker



More information about the R-help mailing list