View source: R/fastMatMR-package.R
fmm_to_sparse_Matrix | R Documentation |
This function reads a Matrix Market file and converts it to a sparse matrix in R using the Matrix package.
fmm_to_sparse_Matrix(filename)
filename |
The name of the input Matrix Market file to be read. |
A dgCMatrix object containing the data read from the Matrix Market file.
# Create
sample_sparse_mat <- Matrix::Matrix(c(1, 0, 0, 2), nrow = 2, sparse = TRUE)
temp_file <- tempfile(fileext = ".mtx")
write_fmm(sample_sparse_mat, temp_file)
# Read
sparse_mat <- fmm_to_sparse_Matrix(temp_file)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.