metacoder (version 0.2.0)

do_calc_on_num_cols: Run some function to produce new columns.

Description

For a given table in a taxmap object, run some function to produce new columns. This function handles all of the option parsing and formatting of the result.

Usage

do_calc_on_num_cols(obj, dataset, func, cols = NULL, other_cols = FALSE,
  out_names = NULL)

Arguments

obj

A taxmap object

dataset

The name of a table in obj.

func

The function to apply. Should accept and return a table.

cols

The names/indexes of columns in dataset to use. By default, all numeric columns are used. Takes one of the following inputs:

TRUE/FALSE:

All/No columns will used.

Character vector:

The names of columns to use

Numeric vector:

The indexes of columns to use

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

Use the columns corresponding to TRUE values.

other_cols

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

TRUE/FALSE:

All non-target columns will be preserved or not.

Character vector:

The names of columns to preserve

Numeric vector:

The indexes of columns to preserve

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

Preserve the columns corresponding to TRUE values.

out_names

If supplied, rename the output proportion columns. Must be the same length as cold.

Value

A tibble