Hi R users,

I want to know whether there is a fast method to compute the nonzeroes for
each column of dgCMatrix.

For summation or average I can use colSums or colMeans. To count the
non-zeroes I write a function

colCounts <- function(Mat) {
    M1 <- apply(Mat, MARGIN=2, FUN=nnzero)
}

But it seems this is quite slow because the apply function would transform a
dgCMatrix to a matrix.

So I come here to ask if there is anybody know some fast method.

--
View this message in context: 
http://r.789695.n4.nabble.com/columnwise-nnzero-for-dgCMatrix-tp3625726p3625726.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to