apply_by_variable: Apply function to variables

Description Usage Arguments Value Examples

Description

Applies a function to the values of each variable

Usage

1
2
apply_by_variable(dataset, fn.to.apply, variables = NULL, 
variable.bounds = NULL, samples = NULL, ...)

Arguments

dataset

list representing the dataset from a metabolomics experiment.

fn.to.apply

function to apply (e.g. mean, max, min).

variables

allows to define which variables to calculate the stats (if numbers, indexes are assumed).

variable.bounds

allow to define an interval of variables (if numeric).

samples

if defined restricts the application to a given set of samples.

...

additional parameters to apply function.

Value

Returns a vector with the variables and the value of the applied function.

Examples

1
2
3
4
     ## Example of applying a function to variables
	 library(specmine.datasets)
     data(cachexia)
     apply.variables.result = apply_by_variable(cachexia, mean)

specmine documentation built on Sept. 21, 2021, 5:06 p.m.