Equivalent of rowsum function for Matrix-class (dgCMatrix)
问题 For the base R matrix class we have the rowsum function, which is very fast for computing column sums across groups of rows. Is there an equivalent function or approach implemented in the Matrix-package? I'm particularly interested in a fast alternative to rowsum for large dgCMatrix-objects (i.e. millions of rows, but roughly 95% sparse). 回答1: I know this is an old question, but Matrix::rowSums might be the function you are looking for. 来源: https://stackoverflow.com/questions/51025979