conversion of an R sparse matrix to a scipy sparse matrix
conversion of an R sparse matrix to a scipy sparse matrix
TO_scipy_sparse(R_sparse_matrix)
Arguments
R_sparse_matrix: an R sparse matrix. Acceptable input objects are either a dgCMatrix or a dgRMatrix.
Details
This function allows the user to convert either an R dgCMatrix or a dgRMatrix to a scipy sparse matrix (scipy.sparse.csc_matrix or scipy.sparse.csr_matrix). This is useful because the RGF package accepts besides an R dense matrix also python sparse matrices as input.
The dgCMatrix class is a class of sparse numeric matrices in the compressed, sparse, column-oriented format. The dgRMatrix class is a class of sparse numeric matrices in the compressed, sparse, row-oriented format.