Closed rcastelo closed 4 months ago
You can use MatrixExtra::rbind_csr
:
do.call(rbind_csr, list(X[1, ], X[2, ], X[3, ]))
Sparse CSR matrix (class 'dgRMatrix')
Dimensions: 3 x 3
(4 entries, 44.44% full)
As for the lack of rbind
with sparseVector
objects, perhaps you could bring that up with the Matrix
authors.
Hi,
I want to iterate through the rows of a large sparse matrix, and found the subsetting-row operator of the MatrixExtra package very handy because it provides a
sparseVector
object for each row. The result of that iteration is again asparseVector
for each row, which I would like to row-bind back into a sparseMatrix. The problem is that, I would do that with ado.call()
, but it chokes when more than two elements in the argument list are given: