Equivalent of rowsum function for Matrix-class (dgCMatrix)

…衆ロ難τιáo~ 提交于 2020-02-23 07:54:08

问题


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/equivalent-of-rowsum-function-for-matrix-class-dgcmatrix

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!