I have a regular matrix (non-sparse) that I would like to convert to a sparseMatrix (using the Matrix package). Is there a function to do this or
sparseMatrix
Matrix
For the matrix, someone already has an answer.
For the data.table, there is a package did the job.
library(Matrix) library(mltools) x = data.table() sparseM <- sparsify(x)