View source: R/assign_traits.R
assign_traits | R Documentation |
A function for assigning traits to taxa at different taxonomic levels.
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)
x |
Results of |
trait_db |
A trait |
group |
Biotic group of interest. Possible values are |
tax_lev |
Taxonomic level at which the calculation has to be performed.
Default to |
dfref |
Reference dataset as used in the function |
filter_by_distance |
Filter the results according to the taxonomic distance. Possible values are |
col_blocks |
A vector containing the number of modalities for each trait. IF |
type |
The type of variables specified in |
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.
average_traits()
: average traits values for fuzzy data
sample_traits()
: sample_traits
aggregate_taxa
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.