Can't seem to merge two medium sized sparse matrices, trying to understand error

160 views Asked by At

rbind fails on these two sparse matrices each, 320k rows x 31k columns, with the error that "problem too large".

I was hoping someone might have some suggestions. One example below first shows attributes of each matrix, system memory, and then tries to bind them using rbind and rbind2(,sparse=T):

enter image description here

1

There are 1 answers

1
Rosalie Bruel On

You could maybe try dplyr and the bind_rows() function? https://dplyr.tidyverse.org/reference/bind.html

library(dplyr)
mat3 <- bind_rows(mat1, mat2)  

I don't understand the error message, and it would be surprising if it was an issue due to the size of the dataset. Just to be sure, you could try binding and inspecting whether it works for a very small subset of your matrices:

rbind(mat1[1:3, ], mat2[1:3, ])