[R] Removing rows with rowsums==0 (I can't figure this out)

Sarah Goslee sarah.goslee at gmail.com
Thu Nov 20 19:02:42 CET 2008


On Thu, Nov 20, 2008 at 12:28 PM, Gavin Simpson <gavin.simpson at ucl.ac.uk> wrote:

> But Prof. Ripley has pointed out (off list) that
>
> ffg[rowSums(ffg) > 0, ]

I suggested much the same solution off-list (using apply rather than
rowSums, as I'm
apparently incapable of remembering the existence of the latter), but
that's not quite
correct either, as we don't know if there can be negative values.

ffg[rowSums(ffg) != 0, ]

is safer.

Sarah

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



More information about the R-help mailing list