Get and set layer data
# S3 method for Assay
$(x, i)
# S3 method for Assay
$(x, i) <- value
An Assay
object
Name of layer data to get or set
A matrix-like object to add as a new layer
$: Layer data for layer i
$<-
: x
with layer data value
saved as i
v3 Assay object, validity, and interaction methods:
Assay-class
,
Assay-validity
,
CreateAssayObject()
,
[.Assay()
,
[[.Assay()
,
dim.Assay()
,
dimnames.Assay()
,
merge.Assay()
,
split.Assay()
,
subset.Assay()
rna <- pbmc_small[["RNA"]]
# Fetch a layer with `$`
rna$data[1:10, 1:4]
#> 10 x 4 sparse Matrix of class "dgCMatrix"
#> ATGCCAGAACGACT CATGGCCTGTGCAT GAACCTGATGAACC TGACTGGATTCTCA
#> MS4A1 . . . .
#> CD79B 4.968821 . . .
#> CD79A . . . .
#> HLA-DRA . 4.776153 . .
#> TCL1A . . . .
#> HLA-DQB1 4.968821 . . .
#> HVCN1 . . . .
#> HLA-DMB . . . .
#> LTB 6.062788 6.714813 7.143118 6.932079
#> LINC00926 . . . .
# Add a layer with `$`
rna$data <- rna$counts
rna$data[1:10, 1:4]
#> 10 x 4 sparse Matrix of class "dgCMatrix"
#> ATGCCAGAACGACT CATGGCCTGTGCAT GAACCTGATGAACC TGACTGGATTCTCA
#> MS4A1 . . . .
#> CD79B 1 . . .
#> CD79A . . . .
#> HLA-DRA . 1 . .
#> TCL1A . . . .
#> HLA-DQB1 1 . . .
#> HVCN1 . . . .
#> HLA-DMB . . . .
#> LTB 3 7 11 13
#> LINC00926 . . . .