assignment: Assignment operator for CSR matrices

assignmentR Documentation

Assignment operator for CSR matrices

Description

Assign values to a CSR matrix. Note: this will only be a relatively fast operation when assigning contiguous row sequences. Only some of the potential assignment cases to a CSR matrix are replaced here - for example, cases that involve uneven recycling of vectors will be left to the 'Matrix' package.

Usage

## S4 replacement method for signature 'dgRMatrix,index,index,replValue'
x[i, j, ...] <- value

## S4 replacement method for signature 'dgRMatrix,missing,index,replValue'
x[i, j, ...] <- value

## S4 replacement method for signature 'dgRMatrix,index,missing,replValue'
x[i, j, ...] <- value

## S4 replacement method for signature 'dgRMatrix,missing,missing,replValue'
x[i, j, ...] <- value

## S4 replacement method for signature 'dgRMatrix,index,index,sparseVector'
x[i, j, ...] <- value

## S4 replacement method for signature 'dgRMatrix,missing,index,sparseVector'
x[i, j, ...] <- value

## S4 replacement method for signature 'dgRMatrix,index,missing,sparseVector'
x[i, j, ...] <- value

## S4 replacement method for signature 'dgRMatrix,missing,missing,sparseVector'
x[i, j, ...] <- value

## S4 replacement method for signature 'ANY,nsparseVector,nsparseVector,replValue'
x[i, j, ...] <- value

## S4 replacement method for signature 'ANY,missing,nsparseVector,replValue'
x[i, j, ...] <- value

## S4 replacement method for signature 'ANY,nsparseVector,missing,replValue'
x[i, j, ...] <- value

## S4 replacement method for signature 'ANY,lsparseVector,lsparseVector,replValue'
x[i, j, ...] <- value

## S4 replacement method for signature 'ANY,missing,lsparseVector,replValue'
x[i, j, ...] <- value

## S4 replacement method for signature 'ANY,lsparseVector,missing,replValue'
x[i, j, ...] <- value

## S4 replacement method for signature 'ANY,nsparseVector,nsparseVector,ANY'
x[i, j, ...] <- value

## S4 replacement method for signature 'ANY,missing,nsparseVector,ANY'
x[i, j, ...] <- value

## S4 replacement method for signature 'ANY,nsparseVector,missing,ANY'
x[i, j, ...] <- value

## S4 replacement method for signature 'ANY,lsparseVector,lsparseVector,ANY'
x[i, j, ...] <- value

## S4 replacement method for signature 'ANY,missing,lsparseVector,ANY'
x[i, j, ...] <- value

## S4 replacement method for signature 'ANY,lsparseVector,missing,ANY'
x[i, j, ...] <- value

Arguments

x

A CSR matrix whose values are to be replaced.

i

The indices of the rows to replace.

j

The indices of the columns to replace.

...

Not used

value

The values to replace with.

Value

The same 'x' input with the values '[i,j]' set to 'value'. If the result is a full matrix (e.g. 'x[,] <- 1'), the object will be a dense matrix from base R.

Examples

library(Matrix)
library(MatrixExtra)
set.seed(1)
X <- rsparsematrix(5, 3, .5, repr="R")
X[1:3] <- 0
print(X)

MatrixExtra documentation built on May 29, 2024, 2:53 a.m.