Type: Package
Title: Classes for Storing and Manipulating Taxonomic Data
Description: Provides classes for storing and manipulating taxonomic data. Most of the classes can be treated like base R vectors (e.g. can be used in tables as columns and can be named). Vectorized classes can store taxon names and authorities, taxon IDs from databases, taxon ranks, and other types of information. More complex classes are provided to store taxonomic trees and user-defined data associated with them.
Version: 0.4.3
Depends: R (≥ 3.0.2), vctrs
LazyLoad: yes
Encoding: UTF-8
License: MIT + file LICENSE
URL: https://docs.ropensci.org/taxa/, https://github.com/ropensci/taxa
BugReports: https://github.com/ropensci/taxa/issues
Imports: dplyr, magrittr, tibble, rlang, stringr, crayon, utils, pillar, methods, viridisLite, cli
Suggests: roxygen2 (≥ 6.0.1), testthat, rmarkdown (≥ 0.9.6)
RoxygenNote: 7.3.1
X-schema.org-applicationCategory: Taxonomy
X-schema.org-keywords: taxonomy, biology, hierarchy
NeedsCompilation: no
Packaged: 2024-02-20 09:19:12 UTC; fosterz
Author: Scott Chamberlain ORCID iD [aut], Zachary Foster ORCID iD [aut, cre]
Maintainer: Zachary Foster <zacharyfoster1989@gmail.com>
Repository: CRAN
Date/Publication: 2024-02-20 09:30:02 UTC

magrittr forward-pipe operator

Description

magrittr forward-pipe operator


Value matching for taxa package

Description

A wrapper for the base value matching %in% that is used to take into consideration features of the taxa package.

Usage

x %in% table

Arguments

x

vector or NULL: the values to be matched. Long vectors are supported.

table

vector or NULL: the values to be matched against. Long vectors are not supported.


Taxonomy class

Description

Experimental lifecycle

Used to store information about a set of taxa forming a taxonomic tree.

Usage

## S3 method for class 'taxa_classification'
x[...]

## S3 method for class 'taxa_classification'
x[[i]]

taxonomy(taxa = taxon(), supertaxa = NA, .names = NULL)

## S3 method for class 'taxa_taxonomy'
names(x)

## S3 replacement method for class 'taxa_taxonomy'
names(x) <- value

## S3 method for class 'taxa_taxonomy'
x[..., subtaxa = TRUE, supertaxa = FALSE, invert = FALSE]

## S3 method for class 'taxa_taxonomy'
x[[i, ..., subtaxa = TRUE, supertaxa = FALSE, invert = FALSE]]

Arguments

taxa

A taxon vector or something that can be converted to a taxon vector.

supertaxa

The indexes of taxa for each taxon's supertaxon.

.names

The names of the vector (not the names of taxa).

Value

An S3 object of class taxa_taxon

See Also

Other classes: classification(), taxon(), taxon_authority(), taxon_db(), taxon_id(), taxon_rank()

Examples


x <- taxonomy(c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo',
                'Panthera tigris', 'Ursidae', 'Ursus', 'Ursus arctos'),
              supertaxa = c(NA, 1, 2, 3, 3, 1, 6, 7))

x <- taxonomy(taxon(name = c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo',
                             'Panthera tigris', 'Ursidae', 'Ursus', 'Ursus arctos'),
                    rank = c('order', 'family', 'genus', 'species',
                             'species', 'family', 'genus', 'species'),
                    id = taxon_id(c('33554', '9681', '9688', '9689',
                                    '9694', '9632', '9639', '9644'),
                                  db = 'ncbi'),
                    auth = c('Bowdich, 1821', 'Fischer de Waldheim, 1817', 'Oken, 1816', 'L., 1758',
                             'L., 1758', 'Fischer de Waldheim, 1817', 'L., 1758', 'L., 1758')),
              supertaxa = c(NA, 1, 2, 3, 3, 1, 6, 7))
names(x) <- letters[1:8]

# Subset taxonomy vector
x[2] # By default, all subtaxa are included
x['b'] # Names can also be used
x[2:3, subtaxa = FALSE] # Disable subtaxa
x[3, supertaxa = TRUE] # include supertaxa
x[is_leaf(x)] # Subset by logical vector

# Get parts of the taxonomy vector
tax_name(x)
tax_rank(x)
tax_id(x)
tax_db(x)
tax_auth(x)
tax_author(x)
tax_date(x)
tax_cite(x)

# Set parts of the taxonomy vector
tax_name(x) <- tolower(tax_name(x))
tax_rank(x)[1] <- NA
tax_id(x) <- '9999'
tax_db(x) <- 'itis'
tax_auth(x) <- NA
tax_author(x)[2:3] <- c('Joe', 'Billy')
tax_date(x) <- c('1999', '2013', '1796', '1899',
                 '1997', '2003', '1996', '1859')
tax_cite(x)['c'] <- 'Linnaeus, C. (1771). Mantissa plantarum altera generum.'

# Convert to table
tibble::as_tibble(x)
as_data_frame(x)

# Get taxonomy attributes
subtaxa(x)
subtaxa(x, value = tax_name(x))
subtaxa(x, value = as_taxon(x))
n_subtaxa(x)
supertaxa(x)
n_supertaxa(x)
leaves(x)
n_leaves(x)
is_leaf(x)
stems(x)
is_stem(x)
roots(x)
is_root(x)
internodes(x)
is_internode(x)


Convert a taxa object to a data.frame

Description

Convert the information in a taxa object to a data.frame using base R vectors as columns. Use as_tibble to convert to tibbles.

Usage

as_data_frame(
  x,
  row.names = NULL,
  optional = FALSE,
  ...,
  stringsAsFactors = FALSE
)

Arguments

x

An object defined by taxa, such as taxon or taxon_id

row.names

NULL or a character vector giving the row names for the data frame. Missing values are not allowed.

optional

logical. If TRUE, setting row names and converting column names (to syntactic names: see make.names) is optional. Note that all of R's base package as.data.frame() methods use optional only for column names treatment, basically with the meaning of data.frame(*, check.names = !optional). See also the make.names argument of the matrix method.

...

additional arguments to be passed to or from methods.

stringsAsFactors

logical: should the character vector be converted to a factor?

Examples

x <- taxon(name = c('Homo sapiens', 'Bacillus', 'Ascomycota', 'Ericaceae'),
           rank = c('species', 'genus', 'phylum', 'family'),
           id = taxon_id(c('9606', '1386', '4890', '4345'), db = 'ncbi'),
           auth = c('Linnaeus, 1758', 'Cohn 1872', NA, 'Juss., 1789'))
as_data_frame(x)


Convert to a taxon vector

Description

Convert other objects to taxon vectors. Compatible base R vectors can also be converted using the taxon constructor.

Usage

as_taxon(x, ...)

Arguments

x

An object to be converted to a taxon vector

...

Additional parameters.

Examples


# Convert a taxonomy object to a taxon vector
x <- taxonomy(taxon(name = c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo',
                             'Panthera tigris', 'Ursidae', 'Ursus', 'Ursus arctos'),
                    rank = c('order', 'family', 'genus', 'species',
                             'species', 'family', 'genus', 'species'),
                    id = taxon_id(c('33554', '9681', '9688', '9689',
                                    '9694', '9632', '9639', '9644'),
                                  db = 'ncbi'),
                    auth = c('Bowdich, 1821', 'Fischer de Waldheim, 1817', 'Oken, 1816', 'L., 1758',
                             'L., 1758', 'Fischer de Waldheim, 1817', 'L., 1758', 'L., 1758')),
              supertaxa = c(NA, 1, 2, 3, 3, 1, 6, 7))
names(x) <- letters[1:8]
as_taxon(x)

# Convert base R vectors
as_taxon(c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo'))
as_taxon(factor(c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo')))


Check that order is ascending

Description

Check that order is ascending and reorder the orders and their levels if needed.

Usage

check_taxon_rank_order(level, order, warn = FALSE)

Arguments

level

Zero or more taxonomic rank names.

order

Integers that determine the relative order of taxonomic levels.

warn

If TRUE, issue a warning when not in ascending order.


Taxon class

Description

Experimental lifecycle

Used to store classifications in reference to a taxonomic tree.

Usage

classification(x = NULL, taxonomy = NULL, .names = NULL)

Arguments

x

One of:

  • A list where each item represents a series of nested taxa. The contents of the list can be in any form that can be converted to a taxon vector.

  • The indexes/names of each instance of a taxon in a taxonomy object specified by the taxonomy option. Can be any length, but must consist of valid indexes for taxa in the taxonomy object.

taxonomy

A taxonomy object. Only needed if taxon indexes are supplied as the first argument.

.names

The names of the vector.

Value

An S3 object of class taxa_classification

See Also

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

Examples


# Create classification vector with a list
x <- classification(list(
  c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo'),
  c('Carnivora', 'Felidae', 'Panthera', 'Panthera tigris'),
  c('Carnivora', 'Ursidae', 'Ursus', 'Ursus arctos'),
  c('Carnivora', 'Ursidae', 'Ursus', 'Ursus arctos'),
  c('Carnivora', 'Felidae', 'Panthera', 'Panthera tigris')
))


# Create classification vector with indexes and a taxonomy
x <- classification(c(3, 4, 4, 5, 5, 6, 8, 8, 2, 5, 6, 2),
                    taxonomy(c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo',
                               'Panthera tigris', 'Ursidae', 'Ursus', 'Ursus arctos'),
                             supertaxa = c(NA, 1, 2, 3, 3, 1, 6, 7)))

x <- classification(c(3, 4, 4, 5, 5, 6, 8, 8, 2, 5, 6, 2),
                    taxonomy(taxon(name = c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo',
                                            'Panthera tigris', 'Ursidae', 'Ursus', 'Ursus arctos'),
                                   rank = c('order', 'family', 'genus', 'species',
                                            'species', 'family', 'genus', 'species'),
                                   id = taxon_id(c('33554', '9681', '9688', '9689',
                                                   '9694', '9632', '9639', '9644'),
                                                 db = 'ncbi'),
                                   auth = c('Bowdich, 1821', 'Fischer, 1817',
                                            'Oken, 1816', 'L., 1758',
                                            'L., 1758', 'Fischer, 1817',
                                            'L., 1758', 'L., 1758')),
                             supertaxa = c(NA, 1, 2, 3, 3, 1, 6, 7)))
names(x) <- letters[1:12]


# Get parts of the classification vector
tax_name(x)
tax_rank(x)
tax_id(x)
tax_db(x)
tax_auth(x)
tax_author(x)
tax_date(x)
tax_cite(x)

# Manipulate classification vectors
x[1:3]
x[tax_rank(x) > 'family']
# c(x, x)
# x['b'] <- NA
is.na(x)
# as.data.frame(x)
# tibble::as_tibble(x)

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


dplyr select_helpers

Description

dplyr select_helpers


Database list

Description

The list of known databases.

Usage

database_ref

Format

An object of class taxa_taxon_db_def (inherits from vctrs_rcrd, vctrs_vctr) of length 8.


Valid taxonomy databases

Description

This defines the valid taxonomic databases that can be used in taxon_db objects and objects that use taxon_db objects, such as taxon_id and taxon. db_ref$get can be used to see information for the databases. Users can add their own custom databases to the list using db_ref$set. For each database the following information is included:

Usage

db_ref

Format

An object of class list of length 3.

Attribution

This code is based on the code handling options in the knitr package.

Examples


# List all database definitions
db_ref$get()

# Get a specific database definition
db_ref$get('ncbi')

# Add or overwrite a database definition
db_ref$set(
  name = "my_new_database",
  url = "http://www.my_tax_database.com",
  desc = "I just made this up",
  id_regex = ".*"
)

# Reset definitions to default values
db_ref$reset()


Defines valid taxonomic databases

Description

Defines valid taxonomic databases

Usage

default_db_ref(defaults = list())

Attribution

This code is copied from the code handling options in the knitr package.


Removes taxa from the taxonomy of a classification that are not used by any of the instances

Description

Removes taxa from the taxonomy of a classification that are not used by any of the instances

Usage

delete_unused_class_taxa(x)

Returns the index of the first occurrence of each unique element

Description

Returns the index of the first occurrence of each unique element

Usage

duplicated_index(x, proxy_func = NULL)

Returns the index of the first occurrence of each unique taxon in a taxonomy

Description

Returns the index of the first occurrence of each unique taxon in a taxonomy

Usage

duplicated_index_taxonomy(x, proxy_func = NULL)

dplyr select_helpers

Description

dplyr select_helpers


dplyr select_helpers

Description

dplyr select_helpers


Default font

Description

A wrapper to make changing the formatting of text printed easier.

Usage

font_default(text)

Arguments

text

What to print.

See Also

Other printer fonts: font_na(), font_punct(), font_secondary(), font_tax_name()


Font for NAs in print methods

Description

A simple wrapper to make changing the formatting of text printed easier. This is used for NAs

Usage

font_na(text)

Arguments

text

What to print

See Also

Other printer fonts: font_default(), font_punct(), font_secondary(), font_tax_name()


Punctuation formatting in print methods

Description

A simple wrapper to make changing the formatting of text printed easier. This is used for non-data, formatting characters

Usage

font_punct(text)

Arguments

text

What to print

See Also

Other printer fonts: font_default(), font_na(), font_secondary(), font_tax_name()


Font for secondary data

Description

A wrapper to make changing the formatting of text printed easier. This is used for print data associated with other data.

Usage

font_secondary(text)

Arguments

text

What to print.

See Also

Other printer fonts: font_default(), font_na(), font_punct(), font_tax_name()


Taxon name formatting in print methods

Description

A simple wrapper to make changing the formatting of text printed easier. This is used for taxon names.

Usage

font_tax_name(text)

Arguments

text

What to print

See Also

Other printer fonts: font_default(), font_na(), font_punct(), font_secondary()


taxa printing functions

Description

Functions used internally for printing information in taxon objects. They have to be exported to work, but they are not intended to be directly used by most users.

Usage

## S3 method for class 'taxa_classification'
format(x, ...)

## S3 method for class 'taxa_classification'
obj_print_data(x, ...)

## S3 method for class 'taxa_classification'
obj_print_footer(x, ...)

## S3 method for class 'taxa_classification'
vec_ptype_abbr(x, ...)

## S3 method for class 'taxa_classification'
vec_ptype_full(x, ...)

## S3 method for class 'taxa_classification'
pillar_shaft(x, ...)

## S3 method for class 'taxa_taxon'
format(x, ...)

## S3 method for class 'taxa_taxon'
obj_print_data(x, ...)

## S3 method for class 'taxa_taxon'
obj_print_footer(x, ...)

## S3 method for class 'taxa_taxon'
vec_ptype_abbr(x, ...)

## S3 method for class 'taxa_taxon'
vec_ptype_full(x, ...)

## S3 method for class 'taxa_taxon'
pillar_shaft(x, ...)

## S3 method for class 'taxa_taxon_authority'
format(x, ...)

## S3 method for class 'taxa_taxon_authority'
obj_print_data(x, ...)

## S3 method for class 'taxa_taxon_authority'
vec_ptype_abbr(x, ...)

## S3 method for class 'taxa_taxon_authority'
vec_ptype_full(x, ...)

## S3 method for class 'taxa_taxon_authority'
pillar_shaft(x, ...)

## S3 method for class 'taxa_taxon_db'
format(x, ...)

## S3 method for class 'taxa_taxon_db'
vec_ptype_abbr(x, ...)

## S3 method for class 'taxa_taxon_db'
vec_ptype_full(x, ...)

## S3 method for class 'taxa_taxon_db_def'
obj_print_data(x, ...)

## S3 method for class 'taxa_taxon_db_def'
vec_ptype_full(x, ...)

## S3 method for class 'taxa_taxon_id'
format(x, ...)

## S3 method for class 'taxa_taxon_id'
obj_print_data(x, ...)

## S3 method for class 'taxa_taxon_id'
vec_ptype_abbr(x, ...)

## S3 method for class 'taxa_taxon_id'
vec_ptype_full(x, ...)

## S3 method for class 'taxa_taxon_id'
pillar_shaft(x, ...)

## S3 method for class 'taxa_taxon_rank'
format(x, ...)

## S3 method for class 'taxa_taxon_rank'
obj_print_data(x, ...)

## S3 method for class 'taxa_taxon_rank'
obj_print_footer(x, ...)

## S3 method for class 'taxa_taxon_rank'
vec_ptype_abbr(x, ...)

## S3 method for class 'taxa_taxon_rank'
vec_ptype_full(x, ...)

## S3 method for class 'taxa_taxon_rank'
pillar_shaft(x, ...)

## S3 method for class 'taxa_taxon_rank_level'
format(x, ...)

## S3 method for class 'taxa_taxon_rank_level'
obj_print_data(x, ...)

## S3 method for class 'taxa_taxon_rank_level'
vec_ptype_abbr(x, ...)

## S3 method for class 'taxa_taxon_rank_level'
vec_ptype_full(x, ...)

## S3 method for class 'taxa_taxon_rank_level'
toString(x, ...)

## S3 method for class 'taxa_taxonomy'
format(x, ...)

## S3 method for class 'taxa_taxonomy'
obj_print_data(x, ...)

## S3 method for class 'taxa_taxonomy'
obj_print_footer(x, ...)

## S3 method for class 'taxa_taxonomy'
vec_ptype_abbr(x, ...)

## S3 method for class 'taxa_taxonomy'
vec_ptype_full(x, ...)

## S3 method for class 'taxa_taxonomy'
pillar_shaft(x, ...)

Fill in NA values in sequence

Description

Fill in the NA values in a ascending sequence based on nearby non-NA values. Used to guess the order values for unknown ranks based on the values of known ranks.

Usage

impute_order_na(order, inc = 1)

Arguments

order

An ascending sequences, possibly with NAs

inc

The increment size to use for values in NA blocks at the start and end of the sequence.


Interleaves two vectors

Description

Taken from "http://r.789695.n4.nabble.com/Interleaving-elements-of-two-vectors-td795123.html"

Usage

interleave(v1, v2)

Get internodes

Description

Get internodes indexes for each taxon or another per-taxon value. An internode is a taxon with exactly one supertaxon and one subtaxon. These taxa can be removed without losing information on the relationships of the remaining taxa.

Usage

internodes(x)

Arguments

x

The object to get internodes for, such as a taxonomy object.

See Also

Other taxonomy functions: leaves(), roots(), stems(), subtaxa(), supertaxa()

Other internode functions: is_internode()

Examples

x <- taxonomy(c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo',
                'Panthera tigris', 'Ursidae', 'Ursus', 'Ursus arctos'),
              supertaxa = c(NA, 1, 2, 3, 3, 1, 6, 7))
internodes(x)


Check if is a classification

Description

Check if an object is the classification class

Usage

is_classification(x)

Arguments

x

An object to test


Check if taxa are internodes

Description

Check if each taxon is an internode. An internode is a taxon with exactly one supertaxon and one subtaxon. These taxa can be removed without losing information on the relationships of the remaining taxa.

Usage

is_internode(x)

Arguments

x

The object to get internodes for, such as a taxonomy object.

See Also

Other internode functions: internodes()

Examples

x <- taxonomy(c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo',
                'Panthera tigris', 'Ursidae', 'Ursus', 'Ursus arctos'),
              supertaxa = c(NA, 1, 2, 3, 3, 1, 6, 7))
is_internode(x)


Check if taxa are leaves

Description

Check if each taxon is a leaf. A leaf is a taxon with no subtaxa. subtaxa.

Usage

is_leaf(x)

Arguments

x

The object to get leaves for, such as a taxonomy object

See Also

Other leaf functions: leaves(), n_leaves()

Examples

x <- taxonomy(c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo',
                'Panthera tigris', 'Ursidae', 'Ursus', 'Ursus arctos'),
              supertaxa = c(NA, 1, 2, 3, 3, 1, 6, 7))
is_leaf(x)


Test if taxa are roots

Description

Check if each taxon is a root. A root is a taxon with no supertaxon.

Usage

is_root(x, subset = NULL)

Arguments

x

An object containing taxonomic relationships, such as taxonomy objects.

subset

The subset of the tree to search for roots to that subset. Can be indexes or names.

See Also

Other root functions: roots()

Examples

x <- taxonomy(c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo',
                'Panthera tigris', 'Ursidae', 'Ursus', 'Ursus arctos'),
              supertaxa = c(NA, 1, 2, 3, 3, 1, 6, 7))
is_root(x)
is_root(x, subset = 2:8)


Check if taxa are stems

Description

Check if each taxon is a stem. A stem is any taxa from a root to the first taxon with multiple subtaxa.

Usage

is_stem(x)

Arguments

x

An object with taxonomic relationships, like taxonomy objects.

See Also

Other stem functions: stems()

Examples

x <- taxonomy(c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo',
                'Panthera tigris'),
              supertaxa = c(NA, 1, 2, 3, 3))
is_stem(x)


Check if something is a taxon object

Description

Check if an object is of the taxon class

Usage

is_taxon(x)

Arguments

x

An object to test

Examples

x <- taxon(c('A', 'B', 'C'))
is_taxon(x)
is_taxon(1:2)


Check if is a taxon_authority

Description

Check if an object is of the taxon_authority class

Usage

is_taxon_authority(x)

Arguments

x

An object to test

Examples

x <- taxon_authority(c('Cham. & Schldl.', 'L.'),
                     date = c('1827', '1753'))
is_taxon_authority(x)
is_taxon_authority(1:3)


Check if something is a taxon_db

Description

Check if an object is of the taxon_db class

Usage

is_taxon_db(x)

Arguments

x

An object to test

Examples

x <- taxon_db(c('ncbi', 'ncbi', 'itis'))
is_taxon_db(x)
is_taxon_db(1:3)


Check if something is a taxon_id object

Description

Check if an object is of the taxon_id class

Usage

is_taxon_id(x)

Arguments

x

An object to test

Examples

x <- taxon_id(c('9606', '1386', '4890', '4345'), db = 'ncbi')
is_taxon_id(x)
is_taxon_id(1:3)


Check if something is a taxon_rank

Description

Check if an object is of the taxon_rank class

Usage

is_taxon_rank(x)

Arguments

x

An object to test

Examples

x <- taxon_rank(c('species', 'species', 'phylum', 'family'))
is_taxon_rank(x)
is_taxon_rank(1:3)


Check if is a taxon id

Description

Check if an object is the taxon id class

Usage

is_taxon_rank_level(x)

Arguments

x

An object to test


Check if something is a taxonomy

Description

Check if an object is of the taxonomy class

Usage

is_taxonomy(x)

Arguments

x

An object to test

Examples

x <- taxonomy(c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo',
                'Panthera tigris', 'Ursidae', 'Ursus', 'Ursus arctos'),
              supertaxa = c(NA, 1, 2, 3, 3, 1, 6, 7))
is_taxonomy(x)
is_taxonomy(1:2)


Check regex validity

Description

Check if a regular expression is valid

Usage

is_valid_regex(text)

Arguments

text

The putative regex to check.


Get leaves

Description

Get leaves indexes for each taxon or another per-taxon value. Leaves are taxa with no subtaxa.

Usage

leaves(x, value = NULL, ...)

Arguments

x

The object to get leaves for, such as a taxonomy object

value

Something to return instead of indexes. Must be the same length as the number of taxa.

...

Additional arguments.

See Also

Other taxonomy functions: internodes(), roots(), stems(), subtaxa(), supertaxa()

Other leaf functions: is_leaf(), n_leaves()

Examples

x <- taxonomy(c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo',
                'Panthera tigris', 'Ursidae', 'Ursus', 'Ursus arctos'),
              supertaxa = c(NA, 1, 2, 3, 3, 1, 6, 7))
leaves(x)
leaves(x, value = tax_name(x))


Print a subset of a character vector

Description

Prints the start and end values for a character vector. The number of values printed depend on the width of the screen by default.

Usage

limited_print(
  chars,
  prefix = "",
  sep = ", ",
  mid = " ... ",
  trunc_char = "[truncated]",
  max_chars = getOption("width") - nchar(prefix) - 5,
  type = "message"
)

Arguments

chars

(character) What to print.

prefix

(character of length 1) What to print before chars, on the same line.

sep

What to put between consecutive values

mid

What is used to indicate omitted values

trunc_char

What is appended onto truncated values

max_chars

(numeric of length 1) The maximum number of characters to print.

type

("error", "warning", "message", "cat", "print", "silent", "plain")

Value

NULL

Examples

taxa:::limited_print(1:100)
taxa:::limited_print(1:10000)
taxa:::limited_print(1:10000, prefix = "stuff:")


dplyr select_helpers

Description

dplyr select_helpers


Number of leaves per taxon

Description

Get the number of leaves per taxon. A leaf is a taxon with no subtaxa.

Usage

n_leaves(x)

Arguments

x

The object to get leaves for, such as a taxonomy object

See Also

Other leaf functions: is_leaf(), leaves()

Examples

x <- taxonomy(c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo',
                'Panthera tigris', 'Ursidae', 'Ursus', 'Ursus arctos'),
              supertaxa = c(NA, 1, 2, 3, 3, 1, 6, 7))
n_leaves(x)


Number of subtaxa per taxon

Description

Get the number of subtaxa per taxon.

Usage

n_subtaxa(x, subset = NULL, max_depth = NULL, include = FALSE)

Arguments

x

The object to get subtaxa for, such as a taxonomy object.

subset

The subset of the tree to search. Can be indexes or names.

max_depth

The number of ranks to traverse. For example, max_depth = 1 returns only immediate subtaxa. By default (NULL) information for all subtaxa is returned (i.e. subtaxa of subtaxa, etc).

include

If TRUE, include information for each taxon in the output.

See Also

Other subtaxa functions: subtaxa()

Examples

# Generate example data
x <- taxonomy(c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo',
                'Panthera tigris', 'Ursidae', 'Ursus', 'Ursus arctos'),
              supertaxa = c(NA, 1, 2, 3, 3, 1, 6, 7))

# Find number of subtaxa (including subtaxa of subtaxa, etc)
n_subtaxa(x)

# Find the number of subtaxa one rank below each taxon
n_subtaxa(x, max_depth = 1)

# Only return data for some taxa (faster than subsetting the whole result)
n_subtaxa(x, subset = 1:3)


Number of supertaxa per taxon

Description

Get the number of supertaxa each taxon is contained in.

Usage

n_supertaxa(x, subset = NULL, max_depth = NULL, include = FALSE)

Arguments

x

The object to get supertaxa for, such as a taxonomy object.

subset

The subset of the tree to search for roots to that subset. Can be indexes or names.

max_depth

The number of levels to traverse. For example, max_depth = 1 returns only immediate supertaxa. By default (NULL) information for all supertaxa is returned.

include

If TRUE, include information for each taxon in the output.

See Also

Other supertaxa functions: supertaxa()

Examples

# Generate example data
x <- taxonomy(c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo',
                'Panthera tigris', 'Ursidae', 'Ursus', 'Ursus arctos'),
              supertaxa = c(NA, 1, 2, 3, 3, 1, 6, 7))

# Find number of supertaxa each taxon is contained in
n_supertaxa(x)

# Only return data for some taxa (faster than subsetting the whole result)
n_supertaxa(x, subset = 1:3)


Minimal classfication constructor

Description

Minimal classfication constructor for internal use. Only use when the input is known to be valid since few validity checks are done.

Usage

new_classification(taxonomy = taxonomy(), instances = integer())

Arguments

taxonomy

A taxonomy() object.

instances

The indexes of each instance of a taxon in the taxonomy. Can be any length.

Value

An S3 object of class taxa_classification


Minimal taxon constructor

Description

Minimal taxon constructor for internal use. Only use when the input is known to be valid since few validity checks are done.

Usage

new_taxon(
  .names = NULL,
  name = character(),
  rank = taxon_rank(),
  id = taxon_id(),
  auth = taxon_authority(),
  ...
)

Arguments

.names

The names of the vector.

name

The names of taxa as a character vector.

rank

The ranks of taxa as a taxon_rank vector.

id

The ids of taxa as a taxon_id vector.

auth

The authority of the taxon as a taxon_authority vector.

Value

An S3 object of class taxa_taxon


Minimal taxon_authority constructor

Description

Minimal taxon_authority constructor for internal use. Only use when the input is known to be valid since few validity checks are done.

Usage

new_taxon_authority(
  .names = NULL,
  author = character(),
  date = character(),
  citation = character()
)

Arguments

.names

The names of the vector.

author

Zero or more author names.

date

Zero or more dates.

citation

Zero or more literature citations.

Value

An S3 object of class taxa_taxon_authority


Minimal taxon_db constructor

Description

Minimal taxon_db constructor for internal use. Only use when the input is known to be valid since few validity checks are done.

Usage

new_taxon_db(db = character(), ...)

Arguments

db

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

...

Additional arguments.

Value

An S3 object of class taxa_taxon_db


Minimal taxon_db_def constructor

Description

Minimal taxon_db_def constructor for internal use. Only use when the input is known to be valid since few validity checks are done.

Usage

new_taxon_db_def(
  name = character(),
  url = character(),
  desc = character(),
  id_regex = character(),
  rank_levels = list()
)

Arguments

name

Name of the database in lower case. Inputs will be transformed to a character vector.

url

URL of the database website. Inputs will be transformed to a character vector.

desc

Description of the database. Inputs will be transformed to a character vector.

id_regex

A regular expression for taxon IDs of the database. Inputs will be transformed to a character vector.

rank_levels

Valid taxonomic ranks for the database. Should be a list of numeric vectors named by taxonomic ranks.

Value

An S3 object of class taxa_taxon_db_def


Minimal taxon_id constructor

Description

Minimal taxon_id constructor for internal use. Only use when the input is known to be valid since few validity checks are done.

Usage

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

Arguments

.names

The names to apply to the vector

id

Zero or more taxonomic ids. Inputs will be transformed to a character vector.

db

The name(s) of the database(s) associated with the IDs. If not NA (the default), the input must consist of names of databases in database_ref. The length must be 0, 1, or equal to the number of IDs.

Value

An S3 object of class taxa_taxon_id


Minimal taxon_rank constructor

Description

Minimal taxon_rank constructor for internal use. Only use when the input is known to be valid since few validity checks are done.

Usage

new_taxon_rank(rank = character(), levels = taxon_rank_level())

Arguments

rank

Zero or more taxonomic rank names. Inputs will be transformed to a character 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 NA instead of a number.

Value

An S3 object of class taxa_taxon_rank


Minimal taxon_rank_level constructor

Description

Minimal taxon_rank_level constructor for internal use. Only use when the input is known to be valid since few validity checks are done.

Usage

new_taxon_rank_level(level = character(), order = numeric())

Arguments

level

Zero or more taxonomic rank names. If a named numeric is applied, the names are used for levels and the numeric values are used for the order. Inputs will be transformed to a character vector.

order

Integers that determine the relative order of taxonomic levels. Inputs will be transformed to a integer vector. NAs can be used to indicate that the order is not known.

Value

An S3 object of class taxa_taxon_rank_level


Minimal taxonomy constructor

Description

Minimal taxonomy constructor for internal use. Only use when the input is known to be valid since few validity checks are done.

Usage

new_taxonomy(taxa = taxon(), supertaxa = integer())

Arguments

taxa

A taxon vector.

supertaxa

The indexes of taxa for each taxon's supertaxon.

Value

An S3 object of class taxa_taxon


dplyr select_helpers

Description

dplyr select_helpers


dplyr select_helpers

Description

dplyr select_helpers


Description

The same as the print function, but can print colored text. Its a bit of a hack, but the only way I found to replicate the behavior of print without rewriting the entire print function.

Usage

print_with_color(x, original_length = length(x), ...)

Arguments

x

What to print, typically a character vector

original_length

The length of the full vector if only part was given.

...

Passed to print


Prepare classification for printing

Description

Prepare classification for printing. Makes color optional.

Usage

printed_classification(x, color = FALSE)

Arguments

color

Use color?

Value

character


Prepare taxon for printing

Description

Prepare taxon for printing. Makes color optional.

Usage

printed_taxon(x, color = FALSE)

Arguments

color

Use color?

Value

character


Prepare taxon_authority for printing

Description

Prepare taxon_authority for printing. Makes color optional.

Usage

printed_taxon_authority(x, color = FALSE)

Arguments

color

Use color?

Value

character


Prepare taxon_id for printing

Description

Prepare taxon_id for printing. Makes color optional.

Usage

printed_taxon_id(x, color = FALSE)

Arguments

color

Use color?

Value

character


Prepare taxon_rank for printing

Description

Prepare taxon_rank for printing. Makes color optional.

Usage

printed_taxon_rank(x, color = FALSE)

Arguments

color

Use color?

Value

character


Prepare taxon_rank_level for printing

Description

Prepare taxon_rank_level for printing. Makes color optional.

Usage

printed_taxon_rank_level(x, color = FALSE)

Arguments

color

Use color?

Value

character


Prepare taxonomy for printing

Description

Prepare taxonomy for printing. Makes color optional.

Usage

printed_taxonomy(x, color = FALSE)

Arguments

color

Use color?

Value

character


Get font color for levels

Description

Make list of crayon style functions to print taxon rank levels in color.

Usage

rank_level_color_funcs(levels)

All known taxonomic ranks

Description

A list of taxonomic ranks from all databases used combined into a single vector to make it easier to maintain the relative order of ranks when data from multiple databases are combined.

Usage

rank_ref

Format

An object of class numeric of length 52.

Attribution

This list was adapted from a similar one in the taxize package.


Get root taxa

Description

Get the indexes of root taxa in a taxonomy.

Usage

roots(x, subset = NULL)

Arguments

x

An object containing taxonomic relationships, such as taxonomy objects.

subset

The subset of the tree to search for roots to that subset. Can be indexes or names.

See Also

Other taxonomy functions: internodes(), leaves(), stems(), subtaxa(), supertaxa()

Other root functions: is_root()

Examples

x <- taxonomy(c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo',
                'Panthera tigris', 'Ursidae', 'Ursus', 'Ursus arctos'),
              supertaxa = c(NA, 1, 2, 3, 3, 1, 6, 7))
roots(x)
roots(x, subset = 2:8)


dplyr select_helpers

Description

dplyr select_helpers


Get stems

Description

Get stem indexes for each taxon or another per-taxon value.

Usage

stems(x, value = NULL, ...)

Arguments

x

An object with taxonomic relationships, like taxonomy objects.

value

Something to return instead of indexes. Must be the same length as the number of taxa.

...

Additional arguments.

See Also

Other taxonomy functions: internodes(), leaves(), roots(), subtaxa(), supertaxa()

Other stem functions: is_stem()

Examples

x <- taxonomy(c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo',
                'Panthera tigris'),
              supertaxa = c(NA, 1, 2, 3, 3))
x <- c(x, x)
stems(x)
stems(x, value = tax_name(x))


Get subtaxa

Description

Get subtaxa indexes for each taxon or another per-taxon value. Subtaxa are taxa contained within a taxon.

Usage

subtaxa(x, subset = NULL, max_depth = NULL, include = FALSE, value = NULL, ...)

Arguments

x

The object to get subtaxa for, such as a taxonomy object.

subset

The subset of the tree to search. Can be indexes or names.

max_depth

The number of ranks to traverse. For example, max_depth = 1 returns only immediate subtaxa. By default (NULL) information for all subtaxa is returned (i.e. subtaxa of subtaxa, etc).

include

If TRUE, include information for each taxon in the output.

value

Something to return instead of indexes. Must be the same length as the number of taxa.

...

Additional arguments.

See Also

Other taxonomy functions: internodes(), leaves(), roots(), stems(), supertaxa()

Other subtaxa functions: n_subtaxa()

Examples

# Generate example data
x <- taxonomy(c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo',
                'Panthera tigris', 'Ursidae', 'Ursus', 'Ursus arctos'),
              supertaxa = c(NA, 1, 2, 3, 3, 1, 6, 7))

# The indexes of all subtaxa (with subtaxa of subtaxa, etc) for each taxon
subtaxa(x)

# The indexes of immediate subtaxa (without subtaxa of subtaxa, etc) for each taxon
subtaxa(x, max_depth = 1)

# Return something other than index
subtaxa(x, value = tax_name(x))

# Include each taxon with its subtaxa
subtaxa(x, value = tax_name(x), include = TRUE)

# Only return data for some taxa (faster than subsetting the whole result)
subtaxa(x, subset = 3)


Get supertaxa

Description

Get supertaxa indexes for each taxon or another per-taxon value. Supertaxa are taxa a taxon is contained in.

Usage

supertaxa(
  x,
  subset = NULL,
  max_depth = NULL,
  include = FALSE,
  value = NULL,
  use_na = FALSE,
  ...
)

Arguments

x

The object to get supertaxa for, such as a taxonomy object.

subset

The subset of the tree to search for roots to that subset. Can be indexes or names.

max_depth

The number of levels to traverse. For example, max_depth = 1 returns only immediate supertaxa. By default (NULL) information for all supertaxa is returned.

include

If TRUE, include information for each taxon in the output.

value

Something to return instead of indexes. Must be the same length as the number of taxa.

use_na

Add a NA to represent the root of the taxonomy (i.e. no supertaxon)

...

Additional arguments.

See Also

Other taxonomy functions: internodes(), leaves(), roots(), stems(), subtaxa()

Other supertaxa functions: n_supertaxa()

Examples

# Generate example data
x <- taxonomy(c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo',
                'Panthera tigris', 'Ursidae', 'Ursus', 'Ursus arctos'),
              supertaxa = c(NA, 1, 2, 3, 3, 1, 6, 7))

# The indexes of all supertaxa (with supertaxa of supertaxa, etc) for each taxon
supertaxa(x)

# Return something other than index
supertaxa(x, value = tax_name(x))

# Include each taxon with its supertaxa
supertaxa(x, value = tax_name(x), include = TRUE)

# Only return data for some taxa (faster than subsetting the whole result)
supertaxa(x, subset = 3)


Set and get taxon authorities

Description

Set and get the taxon authorities in objects that have them, such as taxon objects. Note that this sets all the authority information, such as author name, date, and citations. To set or get just one of part of the authorities, use tax_author, tax_date, or tax_cite instead.

Usage

## S3 method for class 'taxa_classification'
tax_auth(x)

## S3 replacement method for class 'taxa_classification'
tax_auth(x) <- value

tax_auth(x)

tax_auth(x) <- value

## S3 method for class 'taxa_taxon'
tax_auth(x)

## S3 replacement method for class 'taxa_taxon'
tax_auth(x) <- value

## S3 method for class 'taxa_taxonomy'
tax_auth(x)

## S3 replacement method for class 'taxa_taxonomy'
tax_auth(x) <- value

Arguments

x

An object with taxon authorities.

value

The taxon IDs to set. Inputs will be coerced into a taxon_id vector.

Examples

x <- taxon(name = c('Homo sapiens', 'Bacillus', 'Ascomycota', 'Ericaceae'),
           rank = c('species', 'genus', 'phylum', 'family'),
           id = taxon_id(c('9606', '1386', '4890', '4345'), db = 'ncbi'),
           auth = c('Linnaeus, 1758', 'Cohn 1872', NA, 'Juss., 1789'))

tax_auth(x)
tax_auth(x) <- tolower(tax_auth(x))
tax_auth(x)[1] <- 'Billy'


Set and get taxon authors

Description

Set and get taxon authors in objects that have them, such as taxon_authority objects.

Usage

## S3 method for class 'taxa_classification'
tax_author(x)

## S3 replacement method for class 'taxa_classification'
tax_author(x) <- value

tax_author(x)

tax_author(x) <- value

## S3 method for class 'taxa_taxon'
tax_author(x)

## S3 replacement method for class 'taxa_taxon'
tax_author(x) <- value

## S3 replacement method for class 'taxa_taxon_authority'
tax_author(x) <- value

## S3 method for class 'taxa_taxon_authority'
tax_author(x)

## S3 method for class 'taxa_taxonomy'
tax_author(x)

## S3 replacement method for class 'taxa_taxonomy'
tax_author(x) <- value

Arguments

x

An object with taxon authors.

value

The taxon authors to set. Inputs will be coerced into a character vector.

Examples

x <- taxon_authority(c('Cham. & Schldl.', 'L.'),
                     date = c('1827', '1753'))
tax_author(x)
tax_author(x)[1] <- "Billy"
tax_author(x) <- tolower(tax_author(x))


Set and get taxon authority citations

Description

Set and get the taxon authority citations in objects that have them, such as taxon_authority objects.

Usage

## S3 method for class 'taxa_classification'
tax_cite(x)

## S3 replacement method for class 'taxa_classification'
tax_cite(x) <- value

tax_cite(x)

tax_cite(x) <- value

## S3 method for class 'taxa_taxon'
tax_cite(x)

## S3 replacement method for class 'taxa_taxon'
tax_cite(x) <- value

## S3 replacement method for class 'taxa_taxon_authority'
tax_cite(x) <- value

## S3 method for class 'taxa_taxon_authority'
tax_cite(x)

## S3 method for class 'taxa_taxonomy'
tax_cite(x)

## S3 replacement method for class 'taxa_taxonomy'
tax_cite(x) <- value

Arguments

x

An object with taxon authority dates.

value

The taxon citations to set. Inputs will be coerced into a taxon_authority vector.

Examples

x <- taxon_authority(c('Cham. & Schldl.', 'L.'),
                     date = c('1827', '1753'),
                     citation = c(NA, 'Species Plantarum'))
tax_cite(x)
tax_cite(x)[1] <- "Cham. et al 1984"


Set and get taxon authority dates

Description

Set and get the taxon authority dates in objects that have them, such as taxon_authority objects.

Usage

## S3 method for class 'taxa_classification'
tax_date(x)

## S3 replacement method for class 'taxa_classification'
tax_date(x) <- value

tax_date(x)

tax_date(x) <- value

## S3 method for class 'taxa_taxon'
tax_date(x)

## S3 replacement method for class 'taxa_taxon'
tax_date(x) <- value

## S3 replacement method for class 'taxa_taxon_authority'
tax_date(x) <- value

## S3 method for class 'taxa_taxon_authority'
tax_date(x)

## S3 method for class 'taxa_taxonomy'
tax_date(x)

## S3 replacement method for class 'taxa_taxonomy'
tax_date(x) <- value

Arguments

x

An object with taxon authority dates.

value

The taxon authority dates to set. Inputs will be coerced into a character vector.

Examples

x <- taxon_authority(c('Cham. & Schldl.', 'L.'),
                     date = c('1827', '1753'))
tax_date(x)
tax_date(x)[1] <- "1984"
tax_date(x) <- c(NA, '1800')


Set and get taxon ID databases

Description

Set and get the taxon ID databases in objects that have them, such as taxon_id objects.

Usage

## S3 method for class 'taxa_classification'
tax_db(x)

## S3 replacement method for class 'taxa_classification'
tax_db(x) <- value

tax_db(x)

tax_db(x) <- value

## S3 method for class 'taxa_taxon'
tax_db(x)

## S3 replacement method for class 'taxa_taxon'
tax_db(x) <- value

## S3 method for class 'taxa_taxon_id'
tax_db(x)

## S3 replacement method for class 'taxa_taxon_id'
tax_db(x) <- value

## S3 method for class 'taxa_taxonomy'
tax_db(x)

## S3 replacement method for class 'taxa_taxonomy'
tax_db(x) <- value

Arguments

x

An object with taxon authority dates.

value

The taxon citations to set. Inputs will be coerced into a taxon_db vector.

Examples

x <- taxon_id(c('9606', '1386', '4890', '4345'), db = 'ncbi')
tax_db(x)
tax_db(x) <- 'nbn'
tax_db(x)[2] <- 'itis'


Set and get taxon IDs

Description

Set and get the taxon IDs in objects that have them, such as taxon objects.

Usage

## S3 method for class 'taxa_classification'
tax_id(x)

## S3 replacement method for class 'taxa_classification'
tax_id(x) <- value

tax_id(x)

tax_id(x) <- value

## S3 method for class 'taxa_taxon'
tax_id(x)

## S3 replacement method for class 'taxa_taxon'
tax_id(x) <- value

## S3 method for class 'taxa_taxonomy'
tax_id(x)

## S3 replacement method for class 'taxa_taxonomy'
tax_id(x) <- value

Arguments

x

An object with taxon IDs.

value

The taxon IDs to set. Inputs will be coerced into a taxon_id vector.

Examples

x <- taxon(name = c('Homo sapiens', 'Bacillus', 'Ascomycota', 'Ericaceae'),
           rank = c('species', 'genus', 'phylum', 'family'),
           id = taxon_id(c('9606', '1386', '4890', '4345'), db = 'ncbi'),
           auth = c('Linnaeus, 1758', 'Cohn 1872', NA, 'Juss., 1789'))

tax_id(x)
tax_id(x) <- paste0('00', tax_id(x))
tax_id(x)[1] <- '00000'


Set and get taxon names

Description

Set and get the taxon names in objects that have them, such as taxon objects. Note that this is not the same as adding vector names with names.

Usage

## S3 method for class 'taxa_classification'
tax_name(x)

## S3 replacement method for class 'taxa_classification'
tax_name(x) <- value

tax_name(x)

tax_name(x) <- value

## S3 method for class 'taxa_taxon'
tax_name(x)

## S3 replacement method for class 'taxa_taxon'
tax_name(x) <- value

## S3 method for class 'taxa_taxonomy'
tax_name(x)

## S3 replacement method for class 'taxa_taxonomy'
tax_name(x) <- value

Arguments

x

An object with taxon names.

value

The taxon names to set. Inputs will be coerced into a character vector.

Examples

x <- taxon(name = c('Homo sapiens', 'Bacillus', 'Ascomycota', 'Ericaceae'),
           rank = c('species', 'genus', 'phylum', 'family'),
           id = taxon_id(c('9606', '1386', '4890', '4345'), db = 'ncbi'),
           auth = c('Linnaeus, 1758', 'Cohn 1872', NA, 'Juss., 1789'))

tax_name(x)
tax_name(x) <- tolower(tax_name(x))
tax_name(x)[1] <- 'Billy'


Set and get taxon ranks

Description

Set and get the taxon ranks in objects that have them, such as taxon objects.

Usage

## S3 method for class 'taxa_classification'
tax_rank(x)

## S3 replacement method for class 'taxa_classification'
tax_rank(x) <- value

tax_rank(x)

tax_rank(x) <- value

## S3 method for class 'taxa_taxon'
tax_rank(x)

## S3 replacement method for class 'taxa_taxon'
tax_rank(x) <- value

## S3 method for class 'taxa_taxonomy'
tax_rank(x)

## S3 replacement method for class 'taxa_taxonomy'
tax_rank(x) <- value

Arguments

x

An object with taxon ranks.

value

The taxon ranks to set. Inputs will be coerced into a taxon_rank vector.

Examples

x <- taxon(name = c('Homo sapiens', 'Bacillus', 'Ascomycota', 'Ericaceae'),
           rank = c('species', 'genus', 'phylum', 'family'),
           id = taxon_id(c('9606', '1386', '4890', '4345'), db = 'ncbi'),
           auth = c('Linnaeus, 1758', 'Cohn 1872', NA, 'Juss., 1789'))

tax_rank(x)
tax_rank(x) <- 'species'
tax_rank(x)[1] <- taxon_rank('family')


taxa comparison functions

Description

Functions used internally for casting taxon objects to other types. They have to be exported to work, but they are not intended to be directly used by most users.

Usage

## S3 method for class 'taxa_taxon'
vec_proxy_equal(x, ...)

## S3 method for class 'taxa_taxon_authority'
vec_proxy_equal(x, ...)

## S3 method for class 'taxa_taxon_id'
vec_proxy_equal(x, ...)

## S3 method for class 'taxa_taxon_rank'
vec_proxy_compare(x, ...)

## S3 method for class 'taxa_taxon_rank'
vec_proxy_equal(x, ...)

## S3 method for class 'taxa_taxon_rank'
Ops(e1, e2)

## S3 method for class 'taxa_taxonomy'
vec_proxy_equal(x, ...)

Taxon class

Description

Taxon class. See taxon for more information


Taxon authority class

Description

Taxon authority class. See taxon_authority for more information


Taxon database class

Description

Taxon database class. See taxon_db for more information


Taxon ID class

Description

Taxon ID class. See taxon_id for more information


Taxon rank class

Description

Taxon rank class. See taxon_rank for more information


Taxonomy class

Description

Taxonomy class. See taxonomy for more information


Taxon class

Description

Maturing lifecycle

Used to store information about taxa, such as names, ranks, and IDs.

Usage

taxon(name = character(0), rank = NA, id = NA, auth = NA, .names = NA, ...)

Arguments

name

The names of taxa. Inputs with be coerced into a character vector if anything else is given.

rank

The ranks of taxa. Inputs with be coerced into a taxon_rank vector if anything else is given.

id

The ids of taxa. These should be unique identifier and are usually associated with a database. Inputs with be coerced into a taxon_id vector if anything else is given.

auth

The authority of the taxon. Inputs with be coerced into a taxon_authority vector if anything else is given.

.names

The names of the vector.

...

Additional arguments.

Value

An S3 object of class taxa_taxon

See Also

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

Examples


# Create taxon name vector
x <- taxon(c('A', 'B', 'C'))
x <- taxon(name = c('Homo sapiens', 'Bacillus', 'Ascomycota', 'Ericaceae'),
           rank = c('species', 'genus', 'phylum', 'family'),
           id = taxon_id(c('9606', '1386', '4890', '4345'), db = 'ncbi'),
           auth = c('Linnaeus, 1758', 'Cohn 1872', NA, 'Juss., 1789'))
names(x) <- c('a', 'b', 'c', 'd')

# Get parts of the taxon name vector
tax_name(x)
tax_rank(x)
tax_id(x)
tax_db(x)
tax_auth(x)
tax_author(x)
tax_date(x)
tax_cite(x)

# Set parts of the taxon name vector
tax_name(x) <- tolower(tax_name(x))
tax_rank(x)[1] <- NA
tax_name(x)['b'] <- 'Billy'
tax_id(x) <- '9999'
tax_db(x) <- 'itis'
tax_auth(x) <- NA
tax_author(x)[2:3] <- c('Joe', 'Billy')
tax_date(x) <- c('1999', '2013', '1796', '1899')
tax_cite(x)[1] <- 'Linnaeus, C. (1771). Mantissa plantarum altera generum.'

# Manipulate taxon name vectors
x[1:3]
x[tax_rank(x) > 'family']
x['b'] <- NA
x[c('c', 'd')] <- 'unknown'
is.na(x)

# Use 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)


Taxon authority class

Description

Maturing lifecycle

Used to store information on taxon authorities, such as author names, date, and citation.

Usage

taxon_authority(
  author = character(),
  date = "",
  citation = "",
  .names = "",
  extract_date = TRUE
)

Arguments

author

Zero or more author names.

date

Zero or more dates.

citation

Zero or more literature citations.

.names

The names of the vector.

extract_date

If TRUE (the default), then if a date is detected in the author input and no date input is given, then the date is separated from the author input.

Value

An S3 object of class taxa_taxon_authority

See Also

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

Examples


# Making new objects
x <- taxon_authority(c('A', 'B', 'C'))
x <- taxon_authority(c('Cham. & Schldl.', 'L.'),
                     date = c('1827', '1753'))

# Manipulating objects
as.character(x)
x[2]
x[2] <- 'ABC'
names(x) <- c('a', 'b')
x['b'] <- 'David Bowie'
tax_author(x)[1] <- tolower(tax_author(x)[1])
tax_author(x)
tax_date(x) <- c('2000', '1234')
tax_date(x)
tax_cite(x)[2] <- c('Linnaeus, C. (1771). Mantissa plantarum altera generum.')
tax_cite(x)

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

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


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'))


Taxon database definition class

Description

Used to store information on taxonomic databases that is used to validate information in other classes.

Usage

taxon_db_def(
  name = character(),
  url = NA_character_,
  desc = NA_character_,
  id_regex = NA_character_,
  rank_levels = rep(list(NULL), length(name))
)

Arguments

name

Name of the database in lower case. Inputs will be transformed to a character vector.

url

URL of the database website. Inputs will be transformed to a character vector.

desc

Description of the database. Inputs will be transformed to a character vector.

id_regex

A regular expression for taxon IDs of the database. Inputs will be transformed to a character vector.

rank_levels

Valid taxonomic ranks for the database. Should be a list of numeric vectors named by taxonomic ranks.

Value

An S3 object of class taxa_taxon_db_def


Taxon ID class

Description

Maturing lifecycle

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 NA (the default), the input must consist of names of databases in db_ref$get().

.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')


Taxon rank class

Description

Maturing lifecycle

Used to store taxon ranks, possibly associated with a taxonomy database. This is typically used to store taxon ranks in taxon objects.

Usage

taxon_rank(
  rank = character(),
  .names = NULL,
  levels = NULL,
  guess_order = TRUE
)

Arguments

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 NA instead of a number.

guess_order

If TRUE and no rank order is given using numbers, try to guess order based on rank names.

Value

An S3 object of class taxa_taxon_rank

See Also

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

Examples


# 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')


Taxon rank level

Description

Used to store taxon rank level information. This is used in taxon_rank() objects.

Usage

taxon_rank_level(
  level = character(),
  order = NULL,
  guess_order = TRUE,
  impute_na = FALSE
)

Arguments

level

Zero or more taxonomic rank names. If a named numeric is applied, the names are used for levels and the numeric values are used for the order. Inputs will be transformed to a character vector.

order

Integers that determine the relative order of taxonomic levels. Inputs will be transformed to a integer vector. NAs can be used to indicate that the order is not known.

guess_order

If TRUE and no order is given, try to guess order based on rank names.

impute_na

If TRUE, fill in NAs based on nearby values (assumed in ascending order).

Value

An S3 object of class taxa_taxon_rank_level


Remove names from fields in a vctrs rcrd

Description

Remove names from fields in a vctrs rcrd

Usage

unname_fields(x)

Arguments

x

a vctrs rcrd


taxa casting functions

Description

Functions used internally for casting taxon objects to other types. They have to be exported to work, but they are not intended to be directly used by most users.

Usage

## S3 method for class 'taxa_classification'
vec_cast(x, to, ..., x_arg, to_arg)

## Default S3 method:
vec_cast.taxa_classification(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_classification'
vec_cast.taxa_classification(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_classification'
vec_cast.character(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_classification'
vec_cast.factor(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_classification'
vec_cast.integer(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxon'
vec_cast(x, to, ..., x_arg, to_arg)

## Default S3 method:
vec_cast.taxa_taxon(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxon'
vec_cast.taxa_taxon(x, to, ..., x_arg, to_arg)

## S3 method for class 'character'
vec_cast.taxa_taxon(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxon'
vec_cast.character(x, to, ..., x_arg, to_arg)

## S3 method for class 'factor'
vec_cast.taxa_taxon(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxon'
vec_cast.factor(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxon_authority'
vec_cast(x, to, ..., x_arg, to_arg)

## Default S3 method:
vec_cast.taxa_taxon_authority(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxon_authority'
vec_cast.taxa_taxon_authority(x, to, ..., x_arg, to_arg)

## S3 method for class 'character'
vec_cast.taxa_taxon_authority(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxon_authority'
vec_cast.character(x, to, ..., x_arg, to_arg)

## S3 method for class 'factor'
vec_cast.taxa_taxon_authority(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxon_authority'
vec_cast.factor(x, to, ..., x_arg, to_arg)

## S3 method for class 'integer'
vec_cast.taxa_taxon_authority(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxon_authority'
vec_cast.data.frame(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxon_db'
vec_cast(x, to, ..., x_arg, to_arg)

## Default S3 method:
vec_cast.taxa_taxon_db(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxon_db'
vec_cast.taxa_taxon_db(x, to, ..., x_arg, to_arg)

## S3 method for class 'character'
vec_cast.taxa_taxon_db(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxon_db'
vec_cast.character(x, to, ..., x_arg, to_arg)

## S3 method for class 'factor'
vec_cast.taxa_taxon_db(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxon_db'
vec_cast.factor(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxon_db_def'
vec_cast(x, to, ..., x_arg, to_arg)

## Default S3 method:
vec_cast.taxa_taxon_db_def(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxon_db_def'
vec_cast.taxa_taxon_db_def(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxon_id'
vec_cast(x, to, ..., x_arg, to_arg)

## Default S3 method:
vec_cast.taxa_taxon_id(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxon_id'
vec_cast.taxa_taxon_id(x, to, ..., x_arg, to_arg)

## S3 method for class 'character'
vec_cast.taxa_taxon_id(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxon_id'
vec_cast.character(x, to, ..., x_arg, to_arg)

## S3 method for class 'factor'
vec_cast.taxa_taxon_id(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxon_id'
vec_cast.factor(x, to, ..., x_arg, to_arg)

## S3 method for class 'integer'
vec_cast.taxa_taxon_id(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxon_id'
vec_cast.integer(x, to, ..., x_arg, to_arg)

## S3 method for class 'double'
vec_cast.taxa_taxon_id(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxon_id'
vec_cast.double(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxon_id'
vec_cast.data.frame(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxon_rank'
vec_cast(x, to, ..., x_arg, to_arg)

## Default S3 method:
vec_cast.taxa_taxon_rank(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxon_rank'
vec_cast.taxa_taxon_rank(x, to, ..., x_arg, to_arg)

## S3 method for class 'character'
vec_cast.taxa_taxon_rank(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxon_rank'
vec_cast.character(x, to, ..., x_arg, to_arg)

## S3 method for class 'factor'
vec_cast.taxa_taxon_rank(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxon_rank'
vec_cast.factor(x, to, ..., x_arg, to_arg)

## S3 method for class 'double'
vec_cast.taxa_taxon_rank(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxon_rank'
vec_cast.double(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxon_rank'
vec_cast.data.frame(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxon_rank_level'
vec_cast(x, to, ..., x_arg, to_arg)

## Default S3 method:
vec_cast.taxa_taxon_rank_level(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxon_rank_level'
vec_cast.taxa_taxon_rank_level(x, to, ..., x_arg, to_arg)

## S3 method for class 'character'
vec_cast.taxa_taxon_rank_level(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxon_rank_level'
vec_cast.character(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxonomy'
vec_cast(x, to, ..., x_arg, to_arg)

## Default S3 method:
vec_cast.taxa_taxonomy(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxonomy'
vec_cast.taxa_taxonomy(x, to, ..., x_arg, to_arg)

## S3 method for class 'character'
vec_cast.taxa_taxonomy(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxonomy'
vec_cast.character(x, to, ..., x_arg, to_arg)

## S3 method for class 'factor'
vec_cast.taxa_taxonomy(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxonomy'
vec_cast.factor(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxon'
vec_cast.taxa_taxonomy(x, to, ..., x_arg, to_arg)

## S3 method for class 'taxa_taxonomy'
vec_cast.taxa_taxon(x, to, ..., x_arg, to_arg)

taxa coercion functions

Description

Functions used internally for coercing taxon objects and other objects to common data types. They have to be exported to work, but they are not intended to be directly used by most users.

Usage

## S3 method for class 'taxa_classification'
vec_ptype2(x, y, ...)

## Default S3 method:
vec_ptype2.taxa_classification(x, y, ..., x_arg = "", y_arg = "")

## S3 method for class 'vctrs_unspecified'
vec_ptype2.taxa_classification(x, y, ...)

## S3 method for class 'taxa_classification'
vec_ptype2.taxa_classification(x, y, ...)

## S3 method for class 'character'
vec_ptype2.taxa_classification(x, y, ...)

## S3 method for class 'taxa_classification'
vec_ptype2.character(x, y, ...)

## S3 method for class 'factor'
vec_ptype2.taxa_classification(x, y, ...)

## S3 method for class 'taxa_classification'
vec_ptype2.factor(x, y, ...)

## S3 method for class 'taxa_taxon'
vec_ptype2(x, y, ...)

## Default S3 method:
vec_ptype2.taxa_taxon(x, y, ..., x_arg = "", y_arg = "")

## S3 method for class 'vctrs_unspecified'
vec_ptype2.taxa_taxon(x, y, ...)

## S3 method for class 'taxa_taxon'
vec_ptype2.taxa_taxon(x, y, ...)

## S3 method for class 'character'
vec_ptype2.taxa_taxon(x, y, ...)

## S3 method for class 'taxa_taxon'
vec_ptype2.character(x, y, ...)

## S3 method for class 'factor'
vec_ptype2.taxa_taxon(x, y, ...)

## S3 method for class 'taxa_taxon'
vec_ptype2.factor(x, y, ...)

## S3 method for class 'taxa_taxon_authority'
vec_ptype2(x, y, ...)

## Default S3 method:
vec_ptype2.taxa_taxon_authority(x, y, ..., x_arg = "", y_arg = "")

## S3 method for class 'vctrs_unspecified'
vec_ptype2.taxa_taxon_authority(x, y, ...)

## S3 method for class 'taxa_taxon_authority'
vec_ptype2.taxa_taxon_authority(x, y, ...)

## S3 method for class 'character'
vec_ptype2.taxa_taxon_authority(x, y, ...)

## S3 method for class 'taxa_taxon_authority'
vec_ptype2.character(x, y, ...)

## S3 method for class 'factor'
vec_ptype2.taxa_taxon_authority(x, y, ...)

## S3 method for class 'taxa_taxon_authority'
vec_ptype2.factor(x, y, ...)

## S3 method for class 'taxa_taxon_db'
vec_ptype2(x, y, ...)

## Default S3 method:
vec_ptype2.taxa_taxon_db(x, y, ..., x_arg = "", y_arg = "")

## S3 method for class 'vctrs_unspecified'
vec_ptype2.taxa_taxon_db(x, y, ...)

## S3 method for class 'taxa_taxon_db'
vec_ptype2.taxa_taxon_db(x, y, ...)

## S3 method for class 'character'
vec_ptype2.taxa_taxon_db(x, y, ...)

## S3 method for class 'taxa_taxon_db'
vec_ptype2.character(x, y, ...)

## S3 method for class 'factor'
vec_ptype2.taxa_taxon_db(x, y, ...)

## S3 method for class 'taxa_taxon_db'
vec_ptype2.factor(x, y, ...)

## S3 method for class 'taxa_taxon_id'
vec_ptype2(x, y, ...)

## Default S3 method:
vec_ptype2.taxa_taxon_id(x, y, ..., x_arg = "", y_arg = "")

## S3 method for class 'vctrs_unspecified'
vec_ptype2.taxa_taxon_id(x, y, ...)

## S3 method for class 'taxa_taxon_id'
vec_ptype2.taxa_taxon_id(x, y, ...)

## S3 method for class 'character'
vec_ptype2.taxa_taxon_id(x, y, ...)

## S3 method for class 'taxa_taxon_id'
vec_ptype2.character(x, y, ...)

## S3 method for class 'factor'
vec_ptype2.taxa_taxon_id(x, y, ...)

## S3 method for class 'taxa_taxon_id'
vec_ptype2.factor(x, y, ...)

## S3 method for class 'taxa_taxon_rank'
vec_ptype2(x, y, ...)

## Default S3 method:
vec_ptype2.taxa_taxon_rank(x, y, ..., x_arg = "", y_arg = "")

## S3 method for class 'vctrs_unspecified'
vec_ptype2.taxa_taxon_rank(x, y, ...)

## S3 method for class 'taxa_taxon_rank'
vec_ptype2.taxa_taxon_rank(x, y, ...)

## S3 method for class 'character'
vec_ptype2.taxa_taxon_rank(x, y, ...)

## S3 method for class 'taxa_taxon_rank'
vec_ptype2.character(x, y, ...)

## S3 method for class 'factor'
vec_ptype2.taxa_taxon_rank(x, y, ...)

## S3 method for class 'taxa_taxon_rank'
vec_ptype2.factor(x, y, ...)

## S3 method for class 'taxa_taxon_rank_level'
vec_ptype2(x, y, ...)

## Default S3 method:
vec_ptype2.taxa_taxon_rank_level(x, y, ..., x_arg = "", y_arg = "")

## S3 method for class 'vctrs_unspecified'
vec_ptype2.taxa_taxon_rank_level(x, y, ...)

## S3 method for class 'taxa_taxon_rank_level'
vec_ptype2.taxa_taxon_rank_level(x, y, ...)

## S3 method for class 'character'
vec_ptype2.taxa_taxon_rank_level(x, y, ...)

## S3 method for class 'taxa_taxon_rank_level'
vec_ptype2.character(x, y, ...)

## S3 method for class 'taxa_taxonomy'
vec_ptype2(x, y, ...)

## Default S3 method:
vec_ptype2.taxa_taxonomy(x, y, ..., x_arg = "", y_arg = "")

## S3 method for class 'vctrs_unspecified'
vec_ptype2.taxa_taxonomy(x, y, ...)

## S3 method for class 'taxa_taxonomy'
vec_ptype2.taxa_taxonomy(x, y, ...)

## S3 method for class 'character'
vec_ptype2.taxa_taxonomy(x, y, ...)

## S3 method for class 'taxa_taxonomy'
vec_ptype2.character(x, y, ...)

## S3 method for class 'factor'
vec_ptype2.taxa_taxonomy(x, y, ...)

## S3 method for class 'taxa_taxonomy'
vec_ptype2.factor(x, y, ...)