本文介绍了等效于Matrix类的rowum函数(dgCMatrix)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
对于基R矩阵类,我们具有rowsum
函数,该函数对于计算行组之间的列总和非常快.
For the base R matrix class we have the rowsum
function, which is very fast for computing column sums across groups of rows.
在Matrix-package中是否实现了等效的功能或方法?
Is there an equivalent function or approach implemented in the Matrix-package?
对于大型dgCMatrix对象(即数百万行,但稀疏度约为95%)的快速替代品rowsum
,我尤其感兴趣.
I'm particularly interested in a fast alternative to rowsum
for large dgCMatrix-objects (i.e. millions of rows, but roughly 95% sparse).
推荐答案
我知道这是一个老问题,但是Matrix :: rowSums可能就是您要寻找的函数.
I know this is an old question, but Matrix::rowSums might be the function you are looking for.
这篇关于等效于Matrix类的rowum函数(dgCMatrix)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!