Learn R Programming

vegtable (version 0.1.7)

merge_taxa: Merge concepts

Description

Merge taxon concepts form into single ones or insert accepted names to slot samples.

This method is applied to a function defined in the package taxlist-package and only modify the slot species in the input object.

The use of taxa2samples() with merge_to argument will produce a similar result as using merge_taxa with level argument, but taxa2samples() will replace the records in slot samples by the respective accepted names without any modification in slot species. Additionally taxon concept IDs will be addes as columns in samples and taxon traits if indicated in argument add_traits.

Usage

# S4 method for vegtable,numeric,missing
merge_taxa(object, concepts, level, ...)

# S4 method for vegtable,missing,character merge_taxa(object, concepts, level, ...)

taxa2samples(object, ...)

# S4 method for vegtable taxa2samples(object, merge_to, include_levels, na.rm = FALSE, add_traits, ...)

Value

An object of class vegtable.

Arguments

object

Object of class vegtable.

concepts

Numeric (integer) vector including taxon concepts to be merged.

level, merge_to

Character value indicating the level to which the taxa have to be merged.

...

Further arguments passed to taxlist::merge_taxa().

include_levels

Character vector indicating the levels to be considered in the output object. It can be used to exclude some taxonomic ranks.

na.rm

Logical value. Apply to records with missing information on taxonomic rank (i.e. for undetermined specimens).

add_traits

A character vector indicating variables in the slot taxonTraits to be added in slot samples.

Author

Miguel Alvarez kamapu78@gmail.com

Examples

Run this code
## Merge Olea capensis into one
summary(subset(Kenya_veg@species, grepl("Olea capensis", TaxonName),
	   slot="names"), "all")
Kenya_veg <- merge_taxa(Kenya_veg, c(52041,50432,50235))

## Check Olea capensis again
summary(subset(Kenya_veg@species, grepl("Olea capensis", TaxonName),
	   slot="names"), "all")

## Effect of taxa2samples by counting taxa
count_taxa(Kenya_veg, level="genus")

Kenya_veg <- taxa2samples(Kenya_veg, merge_to="genus")
count_taxa(Kenya_veg, level="genus")

Run the code above in your browser using DataLab