Computes phenotype frequencies and proportions per sample. Missing phenotype labels are retained as an explicit unknown category and remain in the sample denominator. This descriptive summary does not test differential abundance.
Arguments
- dt
A
data.tablewith aphenotypecolumn, as returned byphenotype_cells().
Examples
dt <- data.table::data.table(
sample_id = rep("s1", 100),
phenotype = sample(c("CD3+", "CD8+", "Negative"), 100, replace = TRUE)
)
summarise_phenotypes(dt)
#> sample_id phenotype count proportion
#> <char> <char> <int> <num>
#> 1: s1 Negative 34 0.34
#> 2: s1 CD3+ 24 0.24
#> 3: s1 CD8+ 42 0.42