taxon_rank | R Documentation |
Used to store taxon ranks, possibly associated with a taxonomy database. This is typically used to store taxon ranks in taxon objects.
taxon_rank( rank = character(), .names = NULL, levels = NULL, guess_order = TRUE )
rank |
Zero or more taxonomic rank names. Inputs will be transformed to a character vector. |
.names |
The names of the vector |
levels |
A named numeric vector indicating the names and orders of possible taxonomic ranks.
Higher numbers indicate for fine-scale groupings. Ranks of unknown order can be indicated with
|
guess_order |
If |
An S3
object of class taxa_taxon_rank
Other classes:
[.taxa_classification()
,
classification()
,
taxon_authority()
,
taxon_db()
,
taxon_id()
,
taxon()
# Making new objects x <- taxon_rank(c('species', 'species', 'phylum', 'family')) # Specifiying level order taxon_rank(c('A', 'B', 'C', 'D', 'A', 'D', 'D'), levels = c('D', 'C', 'B', 'A')) taxon_rank(c('A', 'B', 'C', 'D', 'A', 'D', 'D'), levels = c(D = NA, A = 10, B = 20, C = 30)) names(x) <- c('a', 'b', 'c', 'd') # Manipulating objects as.character(x) as.factor(x) as.ordered(x) x[2:3] x[x > 'family'] <- taxon_rank('unknown') x[1] <- taxon_rank('order') x['b'] x['b'] <- 'order' # Using as columns in tables tibble::tibble(x = x, y = 1:4) data.frame(x = x, y = 1:4) # Converting to tables tibble::as_tibble(x) as_data_frame(x) # Trying to add an unknown level as a character causes an error #x[2] <- 'superkingdom' # But you can add a new level using taxon_rank objects x[2] <- taxon_rank('superkingdom')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.