Select rows of a data frame based on phenotypes or other expressions.
A data frame
May be a character vector, a one-sided formula, a list
containing such or
A logical vector of length
nrow(csd) which selects rows
select_rows implements a flexible mechanism for selecting cells (rows)
from a cell segmentation table. Cells may be selected by single or
multiple phenotype, by expression level, or combinations of both.
See the tutorial Selecting cells within a cell segmentation table for extensive documentation and examples.
parse_phenotypes for a convenient way to create selectors for most common phenotypes.
csd <- sample_cell_seg_data # Select tumor cells with PDL1 expression > 3 selector <- list('CK+', ~`Entire Cell PDL1 (Opal 520) Mean`>3) pdl1_pos_tumor <- csd[select_rows(csd, selector),] range(pdl1_pos_tumor$`Entire Cell PDL1 (Opal 520) Mean`)#>  3.007 47.459# Select all T-cells. Note: Use c() to combine phenotypes, not list() selector <- c('CD8+', 'FoxP3+') tcells <- csd[select_rows(csd, selector),] table(tcells$Phenotype)#> #> CD8+ FoxP3+ #> 228 228