assign_traits: Assign traits to taxa at different taxonomic levels

View source: R/assign_traits.R

assign_traitsR Documentation

Assign traits to taxa at different taxonomic levels

Description

A function for assigning traits to taxa at different taxonomic levels.

Usage

assign_traits(
  x,
  trait_db = NULL,
  group = "mi",
  tax_lev = "Taxa",
  dfref = NULL,
  filter_by_distance = NULL
)

average_traits(x, col_blocks = NULL, type = "F")

sample_traits(x)

Arguments

x

Results of aggregate_taxa().

trait_db

A trait data.frame with a column Taxa and the other columns containing the traits. By default, the dataset used is the one from Tachet et al. (2010) for macroinvertebrates that can be retrieved from freshwaterecology.info website (Schmidt-Kloiber & Hering, 2015).

group

Biotic group of interest. Possible values are mi for macroinvertebrates, mf for macrophytes and fi for fish. The choice will set the right reference database for the specified group. This option will not be considered if a custom reference database is provided. Default to mi.

tax_lev

Taxonomic level at which the calculation has to be performed. Default to Taxa, the maximum taxonomic level is Family.

dfref

Reference dataset as used in the function aggregate_taxa().

filter_by_distance

Filter the results according to the taxonomic distance. Possible values are pos, neg or a positive integer.

col_blocks

A vector containing the number of modalities for each trait. IF NULL, the default Tachet et al. (2010) col_blocks will be assigned.

type

The type of variables specified in trait_db. Must be one of F, fuzzy, or C, continuous.

Details

This function allows to obtain missing traits for a target taxon by taking traits from lower or to upper taxomic levels. For instance, consider the case where the genus Acroloxus is present in the user dataset and the species Acroloxus lacustris in the traits dataset. A simple merge would exclude Acroloxus from the tha analysis since Acroloxus and A. lacustris would not match. The function assign_traits allows to assign Acroloxus lacustris traits to Acroloxus. This function works also in the opposite direction. Consider the case where there are no traits for the target taxon and the target taxon has not been identified at species level. The function assign_traits will assign the traits of the taxon nearest in the taxonomic tree (e.g. Tanypodinae traits assign to Ablabesmyia monilis). Consider also these examples to understand the behaviour of this function. For instance Anabolia lombarda is present in the user taxomic dataset while only Anabolia nervosa and Anabolia are present in the trait database. In this case assign_traits() will assign only the traits of Anabolia to A. lombarda. Moreover, let's assume that Coelostoma is present in the user dataset while only Berosus and Crenitis punctatostriata are present in the traits dataset. Here assign_traits() will assign the scores of Berosus and C. punctatostriata to Coelostoma because they belong to the same family and there are no information at family level.

The function assign_traits() will calculate the taxonomic distance between the target taxa and the taxa used to assign the trait score. This distance can be positive (e.g. Species to Genus) and negative (e.g. Genus to Species). The distance is measured assigning values as follows: 1 (Species to Genus), 4 (Species to family), -3 (Family to Genus), etc. assign_traits() considers only the taxonomic levels from Subspecies to Family (Subspecies, Species, Genus, Tribus, Subfamily, Family).
The function average_traits() averages traits when traits from multiple taxa are assigned to the same taxon.
Th function sample_traits() samples traits from one taxon when multiple taxa are assigned to the same taxon.

Functions

  • average_traits: average traits values for fuzzy data

  • sample_traits: sample_traits

See Also

aggregate_taxa

Examples

data(macro_ex)

data_bio <- as_biomonitor(macro_ex)
data_agr <- aggregate_taxa(data_bio)
data_ts <- assign_traits(data_agr)

# select only the nearest traits
data_ts_sub <- manage_traits(data_ts, method = "nearest+-")

# averaging
data_ts_av <- average_traits(data_ts_sub)

# traits random sampling
data_ts_st <- sample_traits(data_ts)

alexology/biomonitoR documentation built on April 7, 2024, 10:15 a.m.