[R] [FORGED] Problem related to rowSums
Rolf Turner
r.turner at auckland.ac.nz
Thu Jun 8 00:40:36 CEST 2017
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
More information about the R-help
mailing list