Count selected phenotypes, aggregating by Slide ID and Tissue Category. If multiple tissue categories are selected, include a Total row for each Slide ID.

count_phenotypes(csd, phenotypes, tissue_categories, .by = "Slide ID")

Arguments

csd

Cell seg data to use. This should already have been filtered for the slides or fields of interest.

phenotypes

A named list of phenotype selectors (see phenoptr::parse_phenotypes). Results will be reported in the same order as phenotypes are listed here. To include a row total, phenotypes should contain a "Total" item.

tissue_categories

A character vector of tissue category names of interest.

.by

Column to aggregate by

Value

A data frame with columns for Slide ID, Tissue Category, cell counts for each requested phenotype, and total cells.