aggregateTaxa.RdGiven a taxon and a lineage matrix, aggregate taxa belonging to the same higher-level taxon at the specified taxonomic level by summing their abundance.
aggregateTaxa( x, lineages, taxon.level = "class", unknown = c(NA, "unclassified"), keepUnknown = FALSE, keepSumUnknown = FALSE, returnLineages = FALSE )
| x | an abundance matrix with taxa as rows and samples as columns |
|---|---|
| lineages | a lineage matrix where row names match row names of taxa; taxa must be provided in the same order as in x; first column gives kingdom, following columns give phylum, class, order, family, genus and species |
| taxon.level | taxonomic level to which data set is aggregated (kingdom, phylum, class, order, family, genus or species) |
| unknown | descriptors for unclassified taxa |
| keepUnknown | keep taxa without higher-level taxon classification; cannot be used together with keepSumUnknown |
| keepSumUnknown | keep the sum of taxa without higher-level taxon classification on the desired level as last row (row name: sumUnknown) |
| returnLineages | return lineage matrix for higher-level taxon matrix; if true a list is returned with two elements: abundances and lineages |
the aggregated abundance matrix; if returnLineages is true, a list with aggregated abundances and matching lineages
#> [1] "Number of higher-level taxa: 13" #> [1] 13 7