Reputation: 387
I have downloaded a dataset from LIBSVM and read it in using the e1071
function read.matrix.csr
. This loads it as a SparseM
matrix.csr
object. But now I'm stuck as I can't figure out how to convert this object to a dense matrix.
Is there an easy way to convert a SparseM
matrix.csr
object to a standard R
dense matrix?
Upvotes: 2
Views: 549
Reputation: 387
Found the answer, if X
is a sparse matrix then as.matrix(X)
will convert it to a dense matrix.
Upvotes: 1