Skip to contents

Subset spatial object by cell/spot indices

Usage

subsetSpatialObject(x, indices, column_name = NULL)

Arguments

x

SpatialExperiment or Seurat object

indices

Logical or integer vector for subsetting

column_name

Column name for logical subsetting (for Seurat objects)

Value

Subsetted object

Examples

library(STexampleData)
spe <- Visium_humanDLPFC()
#> see ?STexampleData and browseVignettes('STexampleData') for documentation
#> loading from cache
# Subset first 100 spots
spe_subset <- subsetSpatialObject(spe, 1:100)
ncol(spe_subset)
#> [1] 100