taxon_db: Taxon database class

Description Usage Arguments Value See Also Examples

View source: R/taxon_db.R

Description

\Sexpr[results=rd, stage=render]{taxa2:::lifecycle("maturing")}

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

1
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: taxon_authority(), taxon_id(), taxon_rank(), taxonomy(), taxon()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# 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'))

zachary-foster/taxa2 documentation built on Jan. 1, 2021, 1:48 p.m.