powered by
Apply a function to samples from a metadata's variable.
apply_by_groups(dataset, metadata.var, fn.to.apply = "mean", variables = NULL, variable.bounds = NULL)
list representing the dataset from a metabolomics experiment.
name of the metadata's variable.
function to apply (e.g. mean, max, min).
allows to define which variables to calculate the stats (if numbers, indexes are assumed).
allow to define an interval of variables (if numeric).
Returns a vector with the variables and the value of the applied function on the metadata's groups.
# NOT RUN { ## Example of applying a function to groups library(specmine.datasets) data(cachexia) apply.groups.result = apply_by_groups(cachexia, "Muscle.loss", mean) # }
Run the code above in your browser using DataLab