rsparse (version 0.3.3.2)

slice: CSR Matrices Slicing

Description

natively slice CSR matrices without converting them to triplet/CSC

Usage

# S4 method for RsparseMatrix,index,index,logical
[(x, i, j, drop = TRUE)

# S4 method for RsparseMatrix,missing,index,logical [(x, i, j, drop = TRUE)

# S4 method for RsparseMatrix,index,missing,logical [(x, i, j, drop = TRUE)

# S4 method for RsparseMatrix,missing,missing,logical [(x, i, j, drop = TRUE)

Arguments

x

input RsparseMatrix

i

row indices to subset

j

column indices to subset

drop

whether to simplify 1d matrix to a vector

Value

A RsparseMatrix

Examples

Run this code
# NOT RUN {
library(Matrix)
library(rsparse)
# dgCMatrix - CSC
m = rsparsematrix(20, 20, 0.1)
# make CSR
m = as(m, "RsparseMatrix")
inherits(m[1:2, ], "RsparseMatrix")
inherits(m[1:2, 3:4], "RsparseMatrix")
# }

Run the code above in your browser using DataCamp Workspace