Computes summary nearest neighbor statistics (mean, median, etc)
for each .by
in csd
and each pair of phenotypes in phenotypes
.
Statistics are computed separately for each category in categories
and, if multiple categories are provided, once for all included cells.
Note: If categories
is NA
or includes NA
, the "All" tissue category in
the results will include all cells in csd
. If categories
does not include
NA
, the "All" tissue category will include only cells in the provided
categories.
nearest_neighbor_summary(
csd,
phenotypes = NULL,
categories = NA,
details_path = NULL,
.by = "Slide ID",
extra_cols = NULL
)
Cell seg data with Cell X Position
,
Cell Y Position
, field name and Phenotype
columns.
Optional list of phenotypes to include. If omitted,
will use unique_phenotypes(csd)
.
Optional list of tissue categories to compute within. If
omitted or NA
, all cells will be included.
If present, path to save a tab-separated table for each tissue category containing nearest-neighbor data for each cell in the tissue category.
Column to aggregate by
The names of extra columns to include in the detailed results.
A data frame with summary statistics for each phenotype pair in each Slide ID for each tissue category.