Get and set cell-level meta data
# S3 method for Seurat
$(x, i)
# S3 method for Seurat
$(x, i, ...) <- value
# S4 method for Seurat,character,missing,data.frame
[[(x, i, j, ...) <- value
# S4 method for Seurat,missing,missing,data.frame
[[(x, i, j, ...) <- value
# S4 method for Seurat,character,missing,factor
[[(x, i, j, ...) <- value
# S4 method for Seurat,character,missing,list
[[(x, i, j, ...) <- value
# S4 method for Seurat,missing,missing,list
[[(x, i, j, ...) <- value
# S4 method for Seurat,character,missing,vector
[[(x, i, j, ...) <- value
A Seurat
object
Name of cell-level meta data
Ignored
A vector to add as cell-level meta data
Ignored
$: Metadata column i
for object x
;
note: unlike [[
, $
drops the shape of the metadata
to return a vector instead of a data frame
$<-
: x
with metadata value
saved as i
Seurat object, validity, and interaction methods
Seurat-class
,
Seurat-validity
,
[[.Seurat()
,
[[<-,Seurat
,
[[<-,Seurat,NULL
,
dim.Seurat()
,
dimnames.Seurat()
,
merge.Seurat()
,
names.Seurat()
,
subset.Seurat()
# Get metadata using `$'
head(pbmc_small$groups)
#> ATGCCAGAACGACT CATGGCCTGTGCAT GAACCTGATGAACC TGACTGGATTCTCA AGTCAGACTGCACA
#> "g2" "g1" "g2" "g2" "g2"
#> TCTGATACACGTGT
#> "g1"
# Add metadata using the `$' operator
set.seed(42)
pbmc_small$value <- sample(1:3, size = ncol(pbmc_small), replace = TRUE)
head(pbmc_small[["value"]])
#> value
#> ATGCCAGAACGACT 1
#> CATGGCCTGTGCAT 1
#> GAACCTGATGAACC 1
#> TGACTGGATTCTCA 1
#> AGTCAGACTGCACA 2
#> TCTGATACACGTGT 2