powered by
Convert matrix to sparse list
Matrix2list(x)Matrix2listInt(x)
Matrix2listInt(x)
A two-element list: List of row numbers (r) and a list of numeric or integer values (x)
Input matrix
Øyvind Langsrud
Within the function, the input matrix is first converted to a dgTMatrix matrix (Matrix package).
m = matrix(c(0.5, 1.1, 3.14, 0, 0, 0, 0, 4, 5), 3, 3) Matrix2list(m) Matrix2listInt(m)
Run the code above in your browser using DataLab