Learn R Programming

specmine (version 3.1.6)

aggregate_samples: Aggregate samples

Description

Aggregate samples according to an aggregate function like mean, median, etc.

Usage

aggregate_samples(dataset, indexes, aggreg.fn = "mean", 
meta.to.remove = c())

Arguments

dataset

list representing the dataset from a metabolomics experiment.

indexes

index vector with the samples that are going to be aggregated (e.g. c(1,1,2,2), this index vector will aggregate the first two samples and the last two samples).

aggreg.fn

aggregation function (e.g. "mean", "median", etc).

meta.to.remove

metadata's variables to be removed.

Value

Returns the dataset with the samples aggregated.

Examples

Run this code
# NOT RUN {
  ## Example of aggregating samples
  library(specmine.datasets)
  data(propolis)
  propolis_proc = missingvalues_imputation(propolis)
  dataset = aggregate_samples(propolis_proc, as.integer(propolis$metadata$seasons), "mean") 
# }

Run the code above in your browser using DataLab