assignment | R Documentation |
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.
## 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
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. |
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.
library(Matrix)
library(MatrixExtra)
set.seed(1)
X <- rsparsematrix(5, 3, .5, repr="R")
X[1:3] <- 0
print(X)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.