tax_top: Get names of "top" n taxa

View source: R/tax_top.R

tax_topR Documentation

Get names of "top" n taxa

Description

Simple wrapper around tax_sort that:

  1. optionally aggregates taxa at rank

  2. sorts the aggregated taxa according to by

  3. returns the top n number of taxa names

Usage

tax_top(data, n = 10, by = sum, rank = "unique", use_counts = FALSE, ...)

Arguments

data

phyloseq object or psExtra

n

how many taxa names to return, or NA for all (can return fewer than n values, if there are fewer to return)

by

how to sort taxa (see ?tax_sort()), defaults to sum which sorts by total abundance across all samples

rank

taxonomic rank to aggregate at before calculating ("unique" = no aggregation)

use_counts

use count data if available, instead of transformed data

...

Arguments passed on to tax_sort

verbose

passed to phyloseq_validate verbose (if TRUE: message about suspicious values in tax_table, and how to fix)

trans

name of transformation to apply to taxa before sorting (taxa are returned un-transformed)

Value

vector of taxa names at chosen rank

See Also

tax_agg for more info on taxonomic aggregation

tax_sort for more info on sorting taxa

Examples

data("dietswap", package = "microbiome")
tax_top(dietswap)
tax_top(dietswap, n = 4, by = "prev", rank = "Phylum", undetected = 30)

david-barnett/microViz documentation built on April 17, 2025, 4:25 a.m.