add_taxa: Add a taxonomic hierarchy to a SAFE data worksheet.

Description Usage Arguments Details Value See Also Examples

Description

All datasets containing taxon observations provide taxonomic data (see get_taxa) that can be linked to rows in data worksheets that contain 'taxa' fields. This function matches the taxonomic hierarchy for a dataset for a given taxon field in a data worksheet and inserts fields to show that hierarchy.

Usage

1
2
add_taxa(obj, taxon_field = NULL, taxon_table = NULL, prefix = NULL,
  which = NULL)

Arguments

obj

An existing object of class safedata

taxon_field

The name of a taxon field in a safedata for which to add taxonomic data.

taxon_table

An existing taxon table for a dataset, as generated by get_taxa.

prefix

A string to be appended to taxon field names, primarily to discriminate between fields of multiple taxonomies are to be added.

which

A vector specifying a subset of taxonomy table field names to add.

Details

An existing taxon table can be provided to the function, but the table will be automatically loaded if no table is provided. If a data worksheet only contains a single taxon field, then that field will be used automatically, otherwise users have to specify which taxon field to use. A prefix can be added to taxon fields in order to discrimate between fields from multuple taxon fields. By default, the function adds all of the fields included in the output of get_taxa, but which allows a subset of field names to be used.

Value

A modified safedata object with added taxonomic columns.

See Also

get_taxa

Examples

1
2
3
4
   safedir <- system.file('example_data_dir', package='safedata')
   set_safe_dir(safedir, update=FALSE, validate=FALSE)
   beetle_morph <- load_safe_data(1400562, 'MorphFunctTraits')
   beetle_morph <- add_taxa(beetle_morph)

ImperialCollegeLondon/safe_data documentation built on Oct. 8, 2019, 4:27 p.m.