Method for function rbind() to append objects of class 'traitdata' to each other.

# S3 method for traitdata
rbind(..., metadata = NULL, datasetID = NULL,
  metadata_as_columns = FALSE, drop = NULL)

Arguments

...

two or more objects of class traitdata.

metadata

a list of metadata entries which are to be added as dataset-level information.

datasetID

a vector of the same length as number of objects. If NULL (default), object names will be returned as ID.

metadata_as_columns

logical (defaults to FALSE) or vector of columns to return. If TRUE , the output will contain the "author", "license", "datasetName" and (autogenerated) "datasetID" name, if those are provided. If character vector, the output will contain the listed columns.

drop

FALSE by default. If true, columns that are not present in all datasets will be dropped.

Details

Metadata are ideally already included in the datasets as attributes (see ?as.traitdata). The function rbind.traitdata() takes a list of lists as its metadata argument. The outer list must have the same length as the provided objects to combine, with each entry containing objects according to the terms of the Ecological Traitdata Standard (http://ecologicaltraitdata.github.io/ETS/#metadata-vocabulary).

A lookup table for dataset details will be appended as an attribute to the output dataset, linked to each entry via the field datasetID. It can be accessed by calling attributes(<dataset>)$datasets.

Examples

pulldata("carabids")
#> The dataset 'carabids' is now available for use!
dataset1 <- as.traitdata(carabids, taxa = "name_correct", traits = c("body_length", "antenna_length", "metafemur_length"), units = "mm", keep = c(datasetID = "source_measurement", measurementRemarks = "note"), metadata = as.metadata( bibliographicCitation = c( "van der Plas et al. (2017) Methods in Ecol. & Evol., doi: 10.1111/2041-210x.12728" ), author = "Fons van der Plas", license = "http://creativecommons.org/publicdomain/zero/1.0/" ) )
#> Input is taken to be a species -- trait matrix. If this is not the case, please provide parameters!
traits1 <- 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") ) dataset1Std <- standardize.traits(dataset1, thesaurus = traits1) # occurrence table: pulldata("heteroptera_raw")
#> The dataset 'heteroptera_raw' is now available for use!
dataset2 <- as.traitdata(heteroptera_raw, taxa = "SpeciesID", traits = c("Body_length", "Antenna_Seg1", "Antenna_Seg2", "Antenna_Seg3", "Antenna_Seg4", "Antenna_Seg5", "Hind.Femur_length"), units = "mm", keep = c(sex = "Sex", references = "Source", lifeStage = "Wing_development"), metadata = as.metadata( bibliographicCitation = "Gossner et al. (2015) Ecology, 96:1154. doi: 10.1890/14-2159.1", author = "Martin Gossner", license = "http://creativecommons.org/publicdomain/zero/1.0/" ) )
#> Input is taken to be an occurrence table/an observation -- trait matrix #> (i.e. with individual specimens per row and multiple trait measurements in columns). #> If this is not the case, please provide parameters!
dataset2 <- mutate.traitdata(dataset2, antenna_length = Antenna_Seg1 + Antenna_Seg2 + Antenna_Seg3 + Antenna_Seg4 + Antenna_Seg5 ) traits2 <- 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"), Hind.Femur_length = as.trait("metafemur_length", expectedUnit = "mm", valueType = "numeric", identifier = "http://t-sita.cesab.org/BETSI_vizInfo.jsp?trait=Femur_length") ) dataset2Std <- standardize_traits(dataset2, thesaurus = traits2) database <- rbind(dataset1Std, dataset2Std, datasetID = c("vanderplas17", "gossner15"), metadata_as_columns = c("author"))
#> Warning: There seems to be no overlap in taxon names of the provided datasets! #> It is recommended to map 'ScientificNameStd' of each dataset to the same thesaurus or ontology!
head(database)
#> scientificName traitName #> 1 Aelia acuminata antenna_length #> 2 Aelia acuminata antenna_length #> 3 Aelia klugii antenna_length #> 4 Aelia klugii antenna_length #> 5 Carpocoris fuscispinus antenna_length #> 6 Carpocoris fuscispinus antenna_length #> traitID traitValue #> 1 http://t-sita.cesab.org/BETSI_vizInfo.jsp?trait=Antenna_length 3.74 #> 2 http://t-sita.cesab.org/BETSI_vizInfo.jsp?trait=Antenna_length 3.73 #> 3 http://t-sita.cesab.org/BETSI_vizInfo.jsp?trait=Antenna_length 2.68 #> 4 http://t-sita.cesab.org/BETSI_vizInfo.jsp?trait=Antenna_length 2.19 #> 5 http://t-sita.cesab.org/BETSI_vizInfo.jsp?trait=Antenna_length 5.37 #> 6 http://t-sita.cesab.org/BETSI_vizInfo.jsp?trait=Antenna_length 5.62 #> traitUnit traitNameStd traitValueStd traitUnitStd measurementID #> 1 mm antenna_length 3.74 mm <NA> #> 2 mm antenna_length 3.73 mm <NA> #> 3 mm antenna_length 2.68 mm <NA> #> 4 mm antenna_length 2.19 mm <NA> #> 5 mm antenna_length 5.37 mm <NA> #> 6 mm antenna_length 5.62 mm <NA> #> occurrenceID references measurementRemarks sex #> 1 24 Biodiversity Exploratories <NA> f #> 2 25 Biodiversity Exploratories <NA> m #> 3 26 Zoological State Collection Munich <NA> f #> 4 27 Zoological State Collection Munich <NA> m #> 5 65 Zoological State Collection Munich <NA> f #> 6 66 Biodiversity Exploratories <NA> m #> lifeStage datasetID author #> 1 m gossner15 Martin Gossner #> 2 m gossner15 Martin Gossner #> 3 m gossner15 Martin Gossner #> 4 m gossner15 Martin Gossner #> 5 m gossner15 Martin Gossner #> 6 m gossner15 Martin Gossner #> #> This trait-dataset contains 10 traits for 299 taxa ( 2586 measurements in total). #> $vanderplas17 #> #> vanderplas17 : by Fons van der Plas . #> #> When using these data, you must acknowledge the following usage policies: #> #> Cite this trait dataset as: #> [1] "van der Plas et al. (2017) Methods in Ecol. & Evol., doi: 10.1111/2041-210x.12728" #> #> Published under: http://creativecommons.org/publicdomain/zero/1.0/ #> #> #> $gossner15 #> #> gossner15 : by Martin Gossner . #> #> When using these data, you must acknowledge the following usage policies: #> #> Cite this trait dataset as: #> [1] "Gossner et al. (2015) Ecology, 96:1154. doi: 10.1890/14-2159.1" #> #> Published under: http://creativecommons.org/publicdomain/zero/1.0/ #> #>