get_max_taxonomic_rank_DT: Determine the lowest level of taxonomic classification

View source: R/get_max_taxonomic_rank_DT.R

get_max_taxonomic_rank_DTR Documentation

Determine the lowest level of taxonomic classification

Description

Determine the lowest level of taxonomic classification

Usage

get_max_taxonomic_rank_DT(x, return_rank_only = FALSE)

Arguments

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

Details

This function will find the last non-NA column in the taxonomy table and return

Value

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.

Examples

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)


vmikk/metagMisc documentation built on Feb. 14, 2024, 2:29 a.m.