Learn R Programming

SeuratObject (version 5.0.2)

$.Seurat: Cell-Level Meta Data

Description

Get and set cell-level meta data

Usage

# 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

Value

$: 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

Arguments

x

A Seurat object

i

Name of cell-level meta data

...

Ignored

value

A vector to add as cell-level meta data

j

Ignored

See Also

Seurat object, validity, and interaction methods Seurat-class, Seurat-validity, [[.Seurat(), [[<-,Seurat, [[<-,Seurat,NULL, dim.Seurat(), dimnames.Seurat(), merge.Seurat(), names.Seurat(), subset.Seurat()

Examples

Run this code
# Get metadata using `$'
head(pbmc_small$groups)

# Add metadata using the `$' operator
set.seed(42)
pbmc_small$value <- sample(1:3, size = ncol(pbmc_small), replace = TRUE)
head(pbmc_small[["value"]])

Run the code above in your browser using DataLab