taxon_db {taxa}R Documentation

Taxon database class

Description

Maturing lifecycle

Used to store the names of taxon databases defined in db_ref. Primarily used in other classes like taxon_id to define databases for each item.

Usage

taxon_db(db = character(), .names = NULL, ...)

Arguments

db

Zero or more taxonomic database names. Should be a name contained in db_ref. Inputs will be transformed to a character vector if possible.

.names

The names of the vector.

...

Additional arguments.

Value

An S3 object of class taxa_taxon_db

See Also

Other classes: [.taxa_classification(), classification(), taxon(), taxon_authority(), taxon_id(), taxon_rank()

Examples


# Making new objects
x <- taxon_db(c('ncbi', 'ncbi', 'itis'))
x

# Manipulating objects
as.character(x)
x[2:3]
x[2:3] <- 'nbn'
names(x) <- c('a', 'b', 'c')
x['b']
x['b'] <- 'nbn'
x[x == 'itis'] <- 'gbif'

# Using as columns in tables
tibble::tibble(x = x, y = 1:3)
data.frame(x = x, y = 1:3)

# Converting to tables
tibble::as_tibble(x)
as_data_frame(x)

# Trying to use an invalid database generates an error
# x <- taxon_db(c('ncbi', 'ncbi', 'my_custom_db'))
# x[x == 'itis'] <- 'my_custom_db'

# Listing known databases and their properties
db_ref$get()

# Adding and using a new database
db_ref$set(name = 'my_custom_db', desc = 'I just made this up')
db_ref$get()
x <- taxon_db(c('ncbi', 'ncbi', 'my_custom_db'))


[Package taxa version 0.4.3 Index]