Learn R Programming

SeuratObject (version 5.0.2)

[[.Seurat: Subobjects and Cell-Level Meta Data

Description

The [[ operator pulls either subobjects (eg. v3 or v5 assays, dimensional reduction information, or nearest-neighbor graphs) or cell-level meta data from a Seurat object

Usage

# S3 method for Seurat
[[(x, i = missing_arg(), ..., drop = FALSE, na.rm = FALSE)

# S3 method for Seurat head(x, n = 10L, ...)

# S3 method for Seurat tail(x, n = 10L, ...)

Value

Varies based on the value of i:

  • If i is missing, a data frame with cell-level meta data

  • If i is a vector with cell-level meta data names, a data frame (or vector of drop = TRUE) with cell-level meta data requested

  • If i is a one-length character with the name of a subobject, the subobject specified by i

head: The first n rows of cell-level metadata

tail: The last n rows of cell-level metadata

Arguments

x

A Seurat object

i

Name of cell-level meta data

...

Ignored

drop

See drop

na.rm

Remove cells where meta data is all NA

n

Number of meta data rows to show

See Also

See here for adding meta data with [[<-, here for adding subobjects with [[<-, and here for removing subobjects and cell-level meta data with [[<-

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

Examples

Run this code
# Get the cell-level metadata data frame
head(pbmc_small[[]])

# Pull specific metadata information
head(pbmc_small[[c("letter.idents", "groups")]])
head(pbmc_small[["groups", drop = TRUE]])

# Get a sub-object (eg. an `Assay` or `DimReduc`)
pbmc_small[["RNA"]]
pbmc_small[["pca"]]

# Get the first 10 rows of cell-level metadata
head(pbmc_small)

# Get the last 10 rows of cell-level metadata
tail(pbmc_small)

Run the code above in your browser using DataLab