create_sparse: Create sparse matrix from triplet of coordinates and value

View source: R/sparse.R

create_sparseR Documentation

Create sparse matrix from triplet of coordinates and value

Description

Create sparse matrix from triplet of coordinates and value

Usage

create_sparse(i, j, x = 1)

Arguments

i

A vector of row membership

j

A vector of column membership

x

A vector of the entries that should go in (i, j)

Value

A sparse matrix of class dgCMatrix from the Matrix package

Examples

i <- sample(letters, 10, replace = TRUE)
j <- sample(1:100, 10, replace = TRUE)
create_sparse(i, j)


kylebutts/kfbmisc documentation built on April 17, 2025, 5:20 p.m.