Learn R Programming

textTinyR (version 1.1.8)

dense_2sparse: convert a dense matrix to a sparse matrix

Description

convert a dense matrix to a sparse matrix

Usage

dense_2sparse(dense_mat)

Value

a sparse matrix

Arguments

dense_mat

a dense matrix

Examples

Run this code

library(textTinyR)

tmp = matrix(sample(0:1, 100, replace = TRUE), 10, 10)

sp_mat = dense_2sparse(tmp)

Run the code above in your browser using DataLab