aggregateExpData: Collapse data into unique entries

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/importAndManage.R

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

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

1
2
3
4
5
6
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))

Genominator documentation built on Oct. 31, 2019, 8:56 a.m.