x[i, j] keeps the cells selected by i and the features selected by j.
All components stay aligned: cells and measurements rows are subset
together, dictionary rows follow the kept features, and adjacency contacts
whose cells were removed are dropped. images and channels are kept
unchanged.
Arguments
- x
A
cellspecobject.- i
Cells to keep: a logical vector with one value per cell, or positive or negative integer positions. Missing means all cells.
- j
Features to keep: a character vector of feature identifiers, a logical vector with one value per feature, or integer positions. Missing means all features.
- ...
Not used; must be empty.
- drop
Not used; subsetting always returns a
cellspecobject.
See also
Other methods:
as.data.frame.cellspec(),
cellspec-methods,
plot.cellspec()
Examples
x <- cs_example()
dim(x)
#> [1] 80 19
big <- x[cs_cells(x)$area > 60, ]
dim(big)
#> [1] 47 19
means <- x[, cs_features(x, statistic = "mean")]
dim(means)
#> [1] 80 8