get_tax_level: Get tax level

View source: R/get_tax_level.r

get_tax_levelR Documentation

Get tax level

Description

Processes a vector of txonomy strings and returns a vector with the specified level

Usage

get_tax_level(Tax, level = 4, sepchar = ";")

Arguments

Tax

A data.frame with a column named 'Taxonomy' which is a character vector with taxonomy strings.

level

The level to return

sepchar

The separator of each level in the taxonomy string

Details

It splits each taxonomy string according to separator and returns the specified level. If there are fewer levels than the specified number, it returns the value 'unclassified'

Value

A vector of taxonomy strings truncated at the specified level

Author(s)

Sur Herrera Paredes

Examples

tax <- data.frame(ID = letters[1:4],
                  Taxonomy = c('a;b;c;d','a;b','A;B;C','A;B;C;D'))
get_tax_level(tax, level = 2)

surh/AMOR documentation built on Feb. 21, 2023, 6:31 a.m.