View source: R/get_max_taxonomic_rank.R
get_max_taxonomic_rank | R Documentation |
Determine the lowest level of taxonomic classification
get_max_taxonomic_rank(x, return_rank_only = FALSE)
x |
Either a phyloseq object, or a data frame with columns as taxonomic ranks and rows as entries (e.g., OTUs). Columns in the data frame should be ordered from the highest level of classification (e.g., Kingdom) to the lowest level (e.g., Species), missing data are coded as NA |
return_rank_only |
Logical, if TRUE only name of the taxonomic rank will be returned |
This function will find the last non-NA column in the taxonomy table and return
Data frame with taxonomy and additional column containing the name of the lowest level of taxonomic classification. Alternatively, if 'return_rank_only = TRUE', a vector of the lowest taxonomic ranks for each OTU.
data(GlobalPatterns)
# phyloseq-class as input
taxx <- get_max_taxonomic_rank(GlobalPatterns)
summary(taxx$RankName)
# data frame as input
taxtbl <- as.data.frame(tax_table(GlobalPatterns))
taxx <- get_max_taxonomic_rank(taxtbl)
summary(taxx$RankName)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.