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

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

Value

An R6Class object of class Taxon

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.

See also

Examples

(x <- taxon( name = taxon_name("Poa annua"), rank = taxon_rank("species"), id = taxon_id(93036) ))
#> <Taxon> #> name: Poa annua #> rank: species #> id: 93036 #> authority: none
x$name
#> <TaxonName> Poa annua #> database: none
x$rank
#> <TaxonRank> species #> database: none
x$id
#> <TaxonId> 93036 #> database: none
# a null taxon object taxon(NULL)
#> <Taxon> #> name: none #> rank: none #> id: none #> authority: none
## with all NULL objects from the other classes taxon( name = taxon_name(NULL), rank = taxon_rank(NULL), id = taxon_id(NULL) )
#> <Taxon> #> name: none #> rank: none #> id: none #> authority: none