taxa2samples: Insert taxon information into samples

View source: R/taxa2samples.R

taxa2samplesR Documentation

Insert taxon information into samples

Description

For statistical purposes it may be necessary to insert information on recorded taxa into the slot samples, which contain the records of taxa in sampling plots. This can be also done selectivelly for specific taxonomic ranks and lower ranks can be aggregated to their parental ones.

If column TaxonConceptID is already existing in 'objec@samples', this column will get overwritten, retrieving a warning message.

Usage

taxa2samples(object, ...)

## S3 method for class 'vegtable'
taxa2samples(
  object,
  merge_to,
  include_levels,
  add_relations = FALSE,
  add_traits = FALSE,
  ...
)

Arguments

object

A vegtable object.

...

Further arguments passed among methods.

merge_to

Character value indicating the level (taxonomic rank) to which taxa of lower rank have to be merged.

include_levels

Character vector indicating the levels to be considered in the output object. This will set the values of TaxonConceptID and any respective values inserted from slots taxonRelations and taxonTraits as NA.

add_relations

A logical value indicating whether the content of slot taxonRelations have to be inserted in slot samples or not.

add_traits

A logical value indicating whether the content of slot taxonTraits have to be inserted in slot samples or not.

Value

An object of class vegtable.

Author(s)

Miguel Alvarez kamapu78@gmail.com

Examples

## Add only variable TaxonConceptID
veg <- taxa2samples(Kenya_veg)
head(veg@samples)

## Add also information from slots taxonRelations and taxonTraits
veg <- taxa2samples(Kenya_veg, add_relations = TRUE, add_traits = TRUE)
head(veg@samples)

## Different ranks recorded at samples
veg <- taxa2samples(Kenya_veg, add_relations = TRUE)
summary(veg@samples$Level)

## Aggregate taxa to family level
veg <- taxa2samples(Kenya_veg, add_relations = TRUE, merge_to = "family")
summary(veg@samples$Level)


vegtable documentation built on March 31, 2023, 10:33 p.m.