Aggregate samples

Share:

Description

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

Usage

1
2
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

1
2
3
4
5
6
7
  ## Example of aggregating samples
  data(cassavaPPD)
  index.vector = c(1,1,2,2,2,2,2,1,1,3,3,3,3,3,1,4,4,4,4,4,5,5,6,6,6,6,6,5,5,
		  7,7,7,7,7,8,8,8,8,8,9,9,10,10,10,10,10,9,9,11,11,11,11,11,
		  9,12,12,12,12,12,13,13,14,14,14,14,14,13,13,15,15,15,15,15,
		  13,16,16,16,16,16)
  dataset = aggregate_samples(cassavaPPD, index.vector, "mean") 

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.