2 years ago

#70389

test-img

arko bose

Sparse matrix multiplication in R: error in Ubuntu, flawless in Windows

The CRAN Matrix package can be used to multiply a column vector by its transpose:

product <- Matrix::t(dtm.t) %*% dtm.t

where dtm.t is a column vector created from a Document Term Matrix.

When I run the above line in an Ubuntu installation (versions 6.4 and above), it throws the error message:

Error in Matrix::t(dtm.t) %*% dtm.t : not-yet-implemented method for <dgRMatrix> %*% <dgCMatrix>

which basically means that the multiplication isn't implemented for sparse matrices. This is strange, because objects of class dgRMatrix and dgCMatrix are both defined in the Matrix package.

Interestingly, the line executes without any errors when I run it on a Windows 11 installation.

Has anyone else observed this error? What might be causing it?

r

matrix

sparse-matrix

0 Answers

Your Answer

Accepted video resources