[R] delete all columns with all values equal to zero

Sarah Goslee sarah.goslee at gmail.com
Fri Dec 23 03:42:51 CET 2011


Hi,

On Thu, Dec 22, 2011 at 4:54 PM, Frederico Mestre
<mestre.frederico at gmail.com> wrote:
> Hello all:
>
>
>
> I'm sure this is quite simple, but I tried several options and I still can't
> get I right.
>
>
>
> I've got a data.frame and I want to delete all columns of which the sum is
> zero.

If this, then apply() and sum() are useful.

If the problem in the subject line (NOT the same thing), all() rather
than sum().

A reproducible example will get you usable code.

Sarah

>
>
> Any ideas? Thanks,
>
>
>
> Frederico Mestre
>
>

-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list