Learn R Programming

metacoder (version 0.3.7)

get_taxmap_other_cols: Parse the other_cols option

Description

Parse the other_cols option used in many calculation functions.

Usage

get_taxmap_other_cols(obj, data, cols, other_cols = NULL)

Arguments

obj

A taxmap object

data

The name of a table in obj that contains counts.

cols

The names/indexes of columns in data to use. Takes one of the following inputs:

TRUE/FALSE:

All columns will used.

Vector of TRUE/FALSE of length equal to the number of columns:

Use the columns corresponding to TRUE values.

Character vector:

The names of columns to use

Numeric vector:

The indexes of columns to use

other_cols

Preserve in the output non-target columns present in the input data. The "taxon_id" column will always be preserved. Takes one of the following inputs:

TRUE/FALSE:

All non-target columns will be preserved or not.

Vector of TRUE/FALSE of length equal to the number of columns:

Preserve the columns corresponding to TRUE values.

Character vector:

The names of columns to preserve

Numeric vector:

The indexes of columns to preserve

See Also

Other option parsers: get_taxmap_cols(), get_taxmap_data(), get_taxmap_table(), verify_taxmap()

Examples

Run this code
if (FALSE) {
# Parse data for examples
x = parse_tax_data(hmp_otus, class_cols = "lineage", class_sep = ";",
                   class_key = c(tax_rank = "taxon_rank", tax_name = "taxon_name"),
                   class_regex = "^(.+)__(.+)$")

# If all cols are used, there are no other cols, only "taxon_id"
metacoder:::get_taxmap_other_cols(x, data = "tax_data", cols = TRUE)

# If a subset of target columns is specified, the rest are returned 
metacoder:::get_taxmap_other_cols(x, data = "tax_data", cols = 2:3)

# Additionally, a subset of other columns can be specified
metacoder:::get_taxmap_other_cols(x, data = "tax_data", cols = 2:3,
                                  other_cols = 4:5)
                   
}

Run the code above in your browser using DataLab