taxonomy_table: Convert taxonomy info to a table

Description Arguments Value Examples

View source: R/taxonomy--s3.R

Description

Convert per-taxon information, like taxon names, to a table of taxa (rows) by ranks (columns).

Arguments

obj

A taxonomy or taxmap object

subset

Taxon IDs, TRUE/FALSE vector, or taxon indexes to find supertaxa for. Default: All leaves will be used. Any variable name that appears in all_names() can be used as if it was a vector on its own.

value

What data to return. Default is taxon names. Any result of all_names() can be used, but it usually only makes sense to use data with one value per taxon, like taxon names.

use_ranks

Which ranks to use. Must be one of the following:

  • NULL (the default): If there is rank information, use the ranks that appear in the lineage with the most ranks. Otherwise, assume the number of supertaxa corresponds to rank and use placeholders for the rank column names in the output.

  • TRUE: Use the ranks that appear in the lineage with the most ranks. An error will occur if no rank information is available.

  • FALSE: Assume the number of supertaxa corresponds to rank and use placeholders for the rank column names in the output. Do not use included rank information.

  • character: The names of the ranks to use. Requires included rank information.

  • numeric: The "depth" of the ranks to use. These are equal to n_supertaxa + 1.

add_id_col

If TRUE, include a taxon ID column.

Value

A tibble of taxa (rows) by ranks (columns).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Make a table of taxon names
taxonomy_table(ex_taxmap)

# Use a differnt value
taxonomy_table(ex_taxmap, value = "taxon_ids")

# Return a subset of taxa
taxonomy_table(ex_taxmap, subset = taxon_ranks == "genus")

# Use arbitrary ranks names based on depth
taxonomy_table(ex_taxmap, use_ranks = FALSE)

taxa documentation built on Aug. 10, 2018, 1:12 a.m.