taxon_id {taxa} | R Documentation |
Taxon ID class
Description
Used to store the ID corresponding to taxa, either arbitrary or from a particular taxonomy database. This is typically used to store taxon IDs in taxon objects.
Usage
taxon_id(id = character(), db = "", .names = NULL)
Arguments
id |
Zero or more taxonomic ids. Inputs will be transformed to a character vector if possible. |
db |
The name(s) of the database(s) associated with the IDs. If not |
.names |
The names that will be applied to the vector. |
Value
An S3
object of class taxa_taxon_id
See Also
Other classes:
[.taxa_classification()
,
classification()
,
taxon()
,
taxon_authority()
,
taxon_db()
,
taxon_rank()
Examples
# Making new objects
x <- taxon_id(c('A', 'B', 'C'))
x <- taxon_id(c('9606', '1386', '4890', '4345'), db = 'ncbi')
x <- taxon_id(c('9606', '1386', '4890', '4345'),
db = c('ncbi', 'ncbi', 'itis', 'itis'))
names(x) <- c('a', 'b', 'c', 'd')
# Manipulating objects
as.character(x)
x[2:3]
x[2:3] <- 'ABC'
x[c('a', 'c')] <- '123'
x[['b']] <- taxon_id('123423', db = 'ncbi')
tax_db(x)
tax_db(x) <- 'nbn'
c(x, x)
# Using as columns in tables
tibble::tibble(x = x, y = 1:4)
data.frame(x = x, y = 1:4)
# Convert to tables
tibble::as_tibble(x)
as_data_frame(x)
# Trying to use an invalid ID with a specified database causes an error
#taxon_id('NOLETTERS', db = 'ncbi')
[Package taxa version 0.4.3 Index]