collapseExpData {Genominator} | R Documentation

## 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.

### 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.

### Value

Returns an object of class `ExpData`.

### Author(s)

James Bullard bullard@berkeley.edu, Kasper Daniel Hansen khansen@jhsph.edu

### See Also

See `Genominator` vignette for more information.

### Examples

    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)

[Package Genominator version 1.34.0 Index]