Skip to contents

Get trait values for the data from the Vault database.

Usage

get_traits(
  con = NULL,
  classify_to = c("original", "species", "genus", "family"),
  verbose = TRUE,
  classification_data = NULL
)

Arguments

con

A connection object created using open_vault().

classify_to

A character vector specifying the taxonomic level to classify the taxa to. Default is original.

verbose

A logical indicating whether to print messages. Default is TRUE.

classification_data

An optional data.frame (or tibble) used instead of the TaxonClassification table in the database. Must contain taxon_id and the column matching classify_to (e.g. taxon_genus when classify_to = "genus"). If NULL (default), the database table is used. Obtain a valid table via get_classification_table(con, return_raw_data = TRUE).

Value

A connection object with the data and database connection.

Details

If the function is used after get_taxa(), the trait values will be returned only for the taxa present in the data. If you prefer to return all trait values, we recommend using get_traits() before get_taxa() in the pipe. In addition, it is important to set classify_to to the same value as in get_taxa().