Skip to contents

Go from taxon names to a datelifeQuery object

Usage

make_datelife_query(
  input = c("Rhea americana", "Pterocnemia pennata", "Struthio camelus"),
  use_tnrs = TRUE,
  get_spp_from_taxon = FALSE,
  reference_taxonomy = "ott"
)

Arguments

input

Taxon names as one of the following:

A character vector of taxon names

With taxon names as a single comma separated starting or concatenated with c().

A phylogenetic tree with taxon names as tip labels

As a phylo or multiPhylo object, OR as a newick character string.

use_tnrs

Whether to use Open Tree of Life's Taxonomic Name Resolution Service (TNRS) to process input taxon names. Default to TRUE, it corrects misspellings and taxonomic name variations with tnrs_match(), a wrapper of rotl::tnrs_match_names().

get_spp_from_taxon

Whether to search ages for all species belonging to a given taxon or not. Default to FALSE. If TRUE, it must have same length as input. If input is a newick string with some clades it will be converted to a phylo object, and the order of get_spp_from_taxon will match phy$tip.label.

reference_taxonomy

A character vector specifying the reference taxonomy to use for TNRS. Options are "ott", "ncbi", "gbif" or "irmng". The function defaults to "ott".

Value

A datelifeQuery object, which is a list of three elements:

$phy

A phylo object or NA, if input is not a tree.

$cleaned_names

A character vector of cleaned taxon names.

$ott_ids

A numeric vector of OTT ids if use_tnrs = TRUE, or NULL if use_tnrs = FALSE.

Details

It processes phylo objects and newick character string inputs with input_process(). If input is a multiPhylo object, only the first phylo element will be used. Similarly, if an input newick character string has multiple trees, only the first one will be used.