Skip to content
Back to formatted view

Raw Message

Message-ID: <392b74cd-0636-48c1-9269-aa6323e90c89@auckland.ac.nz>
Date: 2017-06-07T22:40:36Z
From: Rolf Turner
Subject: [FORGED]  Problem related to rowSums
In-Reply-To: <CAAjHrnO6iQMM7UJ5qswT1iE95sjvn8gfbgV5D9HPx8oXbFKQ5A@mail.gmail.com>

On 07/06/17 21:08, Yogesh Gupta wrote:

> Hi...
> 
> I have a dataframe with n columns and n rows. I need to find how many rows
> contains zero raw read count across all column.

(1) You should probably have a *matrix*, not a data frame.

(2) Have you ever heard of the idea of providing a *reproducible* example?

(3) I *think* the following may be what you want/need:

M <- as.matrix(M) # Where the initial M is your "data frame".
sum(apply(M,1,function(x){isTRUE(all.equal(x,rep(0,length(x))))}))

Untested, since you did not supply a reproducible example.

cheers,

Rolf

-- 
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276