[R] columnwise nnzero for dgCMatrix
C6H5NO2
C6H5NO2 at gmail.com
Sun Jun 26 12:15:54 CEST 2011
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.
More information about the R-help
mailing list