metacoder (version 0.3.1)

get_taxmap_data: Get a data set from a taxmap object

Description

NOTE: This will be replaced by the function `get_dataset` in the `taxa` package. Get a data set from a taxmap object and complain if it does not exist. This is intended to be used to parse options in other functions.

Usage

get_taxmap_data(obj, data)

Arguments

obj

A taxmap object

data

Which data set to use. Can be any of the following:

Name

The name of the data set to use.

Index

The index of the data set to use.

TRUE/FALSE vector

A TRUE/FALSE vector the same length as the number of datasets, with exactly one TRUE corresponding to the selected data set.

See Also

Other option parsers: get_taxmap_cols, get_taxmap_other_cols, get_taxmap_table, verify_taxmap

Examples

Run this code
# NOT RUN {
# Parse data
x = parse_tax_data(hmp_otus, class_cols = "lineage", class_sep = ";",
                   class_key = c(tax_rank = "info", tax_name = "taxon_name"),
                   class_regex = "^(.+)__(.+)$")
                   
# Get data set by name
print(metacoder:::get_taxmap_table(x, "tax_data"))
print(metacoder:::get_taxmap_table(x, "invalid"))

# Get data set by index
print(metacoder:::get_taxmap_table(x, 1))
print(metacoder:::get_taxmap_table(x, 3)) # invalid

# Get data set by T/F vector
print(metacoder:::get_taxmap_table(x, c(T, F)))
print(metacoder:::get_taxmap_table(x, c(T, T))) # invalid
print(metacoder:::get_taxmap_table(x, c(T, F, F))) # invalid
                   
# }

Run the code above in your browser using DataCamp Workspace