Create a trait thesaurus object for use as a reference object/lookup table of traits within function standardize.traits().

as.thesaurus(..., replace = NULL)

Arguments

...

multiple objects of class 'trait' (produced by function as.trait()) or a data.frame containing columns according to the terms provided by https://ecologicaltraitdata.github.io/ETS/#terms-for-thesauri.

replace

named character vector, with new names as values, and old names as names.

Value

a list of formalized objects of class 'trait', as returned by function as.trait().

Details

the object class 'trait' comprises necessary information to map a trait name to a trait definition, a target unit and a globally unique identifier. The thesaurus will be used in function 'standardize.traits()' to apply unit conversion and factor level harmonization.

Examples

# provide traitlist by defining individual traits using function `as.trait()`: traitlist <- as.thesaurus(body_length = as.trait("body_length", expectedUnit = "mm", valueType = "numeric", identifier = "http://t-sita.cesab.org/BETSI_vizInfo.jsp?trait=Body_length"), antenna_length = as.trait("antenna_length", expectedUnit = "mm", valueType = "numeric", identifier = "http://t-sita.cesab.org/BETSI_vizInfo.jsp?trait=Antenna_length"), metafemur_length = as.trait("metafemur_length", expectedUnit = "mm", valueType = "numeric", identifier = "http://t-sita.cesab.org/BETSI_vizInfo.jsp?trait=Femur_length") ) # provide traitlist from data frame object: as.thesaurus(data.frame( trait = c("body_length", "antenna_length", "metafemur_length", "eyewidth_corr"), expectedUnit = "mm", valueType = "numeric", traitDescription = c("body length in mm", "length of antenna in mm", "length of metafemur in mm", "eye width in mm"), identifier = c("http://t-sita.cesab.org/BETSI_vizInfo.jsp?trait=Body_length", "http://t-sita.cesab.org/BETSI_vizInfo.jsp?trait=Antenna_length", "http://t-sita.cesab.org/BETSI_vizInfo.jsp?trait=Femur_length", "http://t-sita.cesab.org/BETSI_vizInfo.jsp?trait=Eye_diameter" ) ) )
#> trait #> antenna_length antenna_length #> body_length body_length #> eyewidth_corr eyewidth_corr #> metafemur_length metafemur_length #> identifier #> antenna_length http://t-sita.cesab.org/BETSI_vizInfo.jsp?trait=Antenna_length #> body_length http://t-sita.cesab.org/BETSI_vizInfo.jsp?trait=Body_length #> eyewidth_corr http://t-sita.cesab.org/BETSI_vizInfo.jsp?trait=Eye_diameter #> metafemur_length http://t-sita.cesab.org/BETSI_vizInfo.jsp?trait=Femur_length #> broaderTerm narrowerTerm expectedUnit maxAllowedValue #> antenna_length NA NA mm NA #> body_length NA NA mm NA #> eyewidth_corr NA NA mm NA #> metafemur_length NA NA mm NA #> minAllowedValue factorLevels valueType #> antenna_length NA NA numeric #> body_length NA NA numeric #> eyewidth_corr NA NA numeric #> metafemur_length NA NA numeric #> traitDescription comments relationSource source #> antenna_length length of antenna in mm NA NA NA #> body_length body length in mm NA NA NA #> eyewidth_corr eye width in mm NA NA NA #> metafemur_length length of metafemur in mm NA NA NA #> version author #> antenna_length NA NA #> body_length NA NA #> eyewidth_corr NA NA #> metafemur_length NA NA
# provide traitlist from remote archive with renaming traits1 <- as.thesaurus(read.csv("https://raw.githubusercontent.com/EcologicalTraitData/TraitDataList/master/traitdatastandard_traitlist.csv"), replace = c(traitID = "identifier", traitName = "trait", traitUnit = "expectedUnit", Comments = "comments") )