aggregateExpData {Genominator} | R Documentation

## Collapse data into unique entries

### Description

Collapses data based on unique combinations of values in a set of columns, by default adding a column giving counts of data entries with a particular combination.

### Usage

    aggregateExpData(expData, by = getIndexColumns(expData),
      tablename = NULL, deleteOriginal = FALSE, overwrite = FALSE,
      verbose = getOption("verbose"), colname = "counts",
      aggregator = paste("count(", by[1], ")", sep = ""))

### Arguments

`expData` | An object of class `ExpData`.
`by` | Vector containing column names used to define unique entries.
`tablename` | Name of database table to write output data to.
`deleteOriginal` | Logical indicating whether original database table in `ExpData` object should be deleted.
`overwrite` | Logical indicating whether database table referred to in `tablename` argument should be overwritten.
`verbose` | Logical indicating whether details should be printed.
`colname` | Name of column for recording aggregation output (by default, `counts`).
`aggregator` | SQLite code used for aggregating. See `Details` for more information.

### Details

By default this function counts instances of data entries with a particular combination of the values in the set of columns indicated in the `by` argument. Other SQLite commands can be indicated using the `aggregator` argument.

### Value

Returns an `ExpData` object.

### Author(s)

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

### See Also

See `Genominator` vignette for more information.

### Examples

    N  <- 10000 # the number of observations.
    df <- data.frame(chr = sample(1:16, size = N, replace = TRUE),
                     location = sample(1:1000, size = N, replace = TRUE),
                     strand = sample(c(1L,-1L), size = N, replace = TRUE))
    eDataRaw <- aggregateExpData(importToExpData(df, dbFilename = tempfile(),
                                 tablename = "ex_tbl", overwrite = TRUE))

[Package Genominator version 1.40.0 Index]