Learn R Programming

Genominator (version 1.26.0)

collapseExpData: Combine multiple data sets

Description

This function takes a dataset with data from multiple experiments, and combines the data across multiple experiments according to a user-specified function.

Usage

collapseExpData(expData, tablename = NULL, what = getColnames(expData, all = FALSE), groups = "COL", collapse = c("sum", "avg", "weighted.avg"), overwrite = FALSE, deleteOriginal = FALSE, verbose = getOption("verbose"))

Arguments

expData
An object of class ExpData.
tablename
Name of database table to write output data to.
what
Data columns to apply collapse function to.
groups
Vector of length what indicating how columns should be grouped when applying collapse function.
collapse
Function to apply to grouped columns.
overwrite
Logical indicating whether database referred to in tablename argument should be overwritten.
deleteOriginal
Logical indicating whether original database in ExpData object should be deleted.
verbose
Logical indicating whether details should be printed.

Value

Returns an object of class ExpData.

Details

This function can be thought of as similar to tapply, operating over the entries in the data set, applying the function specified in the collapse argument, grouping the data as indicated in the groups argument.

See Also

See Genominator vignette for more information.

Examples

Run this code
ed <- ExpData(system.file(package = "Genominator", "sample.db"),
              tablename = "raw")
nd <- importToExpData(head(ed, -1), dbFilename = tempfile(),
                      tablename = "collapsed")
head(nd)
cd <- collapseExpData(nd, tablename = "bio", overwrite = TRUE,
                      groups = c("mut", "mut", "wt", "wt"))
                      
head(cd)

Run the code above in your browser using DataLab