regroup_taxa: Regroup some categories along a taxonomy

Description Usage Arguments Examples

Description

Categories are usually labelled something like "crust_copepods_calanus", "crust_copepods_euchaeta", "crust_larvae", etc.; with different taxonomic levels separated by "_". This function regroups categories in higher level taxonomic units (such as "crust" here).

Usage

1
regroup_taxa(x, level = 1, pattern = NULL, separator = "_")

Arguments

x

vector of categories (usually the "Valid" column of the data.frame produced by read_ids)

level

level at which to regroup (1 is what precedes the first separator, 2 is what precedes the second separator, etc.)

pattern

when provided, only act on categories whose name matches the pattern (matching is done by stringr::str_detect)

separator

character used to separate taxonomic levels in category names; usually "_"

Examples

1
2
3
4
x <- c("append_fritill", "append_housing", "crust_copepods_calanus", "crust_copepods_euchaeta", "crust_larvae")
regroup_taxa(x)
regroup_taxa(x, level=2)
regroup_taxa(x, pattern="crust")

jiho/zooprocessr documentation built on May 19, 2019, 10:31 a.m.