Subsetting LEMs | R Documentation |
Methods to subset LinearEmbeddingMatrix objects.
## S4 method for signature 'LinearEmbeddingMatrix,ANY,ANY'
x[i, j, ..., drop=TRUE]
## S4 replacement method for signature
## 'LinearEmbeddingMatrix,ANY,ANY,LinearEmbeddingMatrix'
x[i, j] <- value
x |
A LinearEmbeddingMatrix object. |
i, j |
A vector of logical or integer subscripts, indicating the rows and columns to be subsetted for |
... |
Extra arguments that are ignored. |
drop |
A logical scalar indicating whether the result should be coerced to the lowest possible dimension. |
value |
A LinearEmbeddingMatrix object with number of rows equal to length of |
Subsetting yields a LinearEmbeddingMatrix object containing the specified rows (samples) and columns (factors).
If column subsetting is performed, values of featureLoadings
and factorData
will be modified to retain only the selected factors.
If drop=TRUE
and the subsetting would produce dimensions of length 1, those dimensions are dropped and a vector is returned directly from sampleFactors
.
This mimics the expected behaviour from a matrix-like object.
Users should set drop=FALSE
to ensure that a LinearEmbeddingMatrix is returned.
For subset replacement, if neither i
or j
are set, x
will be effectively replaced by value
.
However, row and column names will not change, consistent with replacement in ordinary matrices.
For [
, a subsetted LinearEmbeddingMatrix object is returned.
For [<-
, a modified LinearEmbeddingMatrix object is returned.
Aaron Lun
LinearEmbeddingMatrix-class
example(LinearEmbeddingMatrix, echo=FALSE) # using the class example
lem[1:10,]
lem[,1:5]
lem2 <- lem
lem2[1:10,] <- lem[11:20,]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.