taxon: Taxon class

View source: R/old_taxa--taxon.R

taxonR Documentation

Taxon class

Description

A class used to define a single taxon. Most other classes in the taxa package include one or more objects of this class.

Usage

taxon(name, rank = NULL, id = NULL, authority = NULL)

Arguments

name

a TaxonName object [taxon_name()] or character string. if character passed in, we'll coerce to a TaxonName object internally, required

rank

a TaxonRank object [taxon_rank()] or character string. if character passed in, we'll coerce to a TaxonRank object internally, required

id

a TaxonId object [taxon_id()], numeric/integer, or character string. if numeric/integer/character passed in, we'll coerce to a TaxonId object internally, required

authority

(character) a character string, optional

Details

Note that there is a special use case of this function - you can pass 'NULL' as the first parameter to get an empty 'taxon' object. It makes sense to retain the original behavior where nothing passed in to the first parameter leads to an error, and thus creating a 'NULL' taxon is done very explicitly.

Value

An 'R6Class' object of class 'Taxon'

See Also

Other classes: hierarchies(), hierarchy(), taxa(), taxmap(), taxon_database(), taxon_id(), taxon_name(), taxon_rank(), taxonomy()

Examples

(x <- taxon(
  name = taxon_name("Poa annua"),
  rank = taxon_rank("species"),
  id = taxon_id(93036)
))
x$name
x$rank
x$id

# a null taxon object
taxon(NULL)
## with all NULL objects from the other classes
taxon(
  name = taxon_name(NULL),
  rank = taxon_rank(NULL),
  id = taxon_id(NULL)
)

metacoder documentation built on April 4, 2023, 9:08 a.m.