
Aggregate Feature Table by Taxonomy Level
Source:R/mStat_aggregate_by_taxonomy.R
mStat_aggregate_by_taxonomy.RdAggregates a feature table within a MicrobiomeStat data object by one or more specified taxonomy levels. The aggregated tables are stored in the `feature.agg.list` component of the data object.
Value
The input data.obj with an added/updated `feature.agg.list` component containing aggregated feature tables for each specified taxonomy level.
Details
This function is the primary interface for taxonomy aggregation in MicrobiomeStat. It supports aggregating to multiple taxonomy levels in a single call, storing results in a named list for easy access.
The aggregation uses an inner join between feature.tab and feature.ann, meaning only features present in both tables will be included in the output. A message is displayed if any features are excluded due to mismatches.
See also
mStat_aggregate_by_taxonomy2 for a lower-level interface
that works directly with matrices.
Examples
if (FALSE) { # \dontrun{
library(vegan)
data(peerj32.obj)
# Aggregate by multiple taxonomy levels
peerj32.obj <- mStat_aggregate_by_taxonomy(
peerj32.obj,
feature.level = c("Phylum", "Family", "Genus")
)
# Access aggregated tables
phylum_table <- peerj32.obj$feature.agg.list$Phylum
family_table <- peerj32.obj$feature.agg.list$Family
} # }