joinExpData: Merge ExpData objects

Description Usage Arguments Value Author(s) See Also Examples

View source: R/importAndManage.R

Description

This function merges multiple ExpData object into one in an efficient manner.

Usage

1
2
3
joinExpData(expDataList, fields = NULL, tablename = "aggtable",
  overwrite = TRUE, deleteOriginals = FALSE,
  verbose = getOption("verbose"))

Arguments

expDataList

List of ExpData objects. Must all be contained in the same database.

fields

A named list whose names correspond to tables of ExpData objects and whose entries indicate the column names to be pulled from each table.

tablename

Name of database table to write output data to.

overwrite

Logical indicating whether database table referred to in tablename argument should be overwritten.

deleteOriginals

Logical indicating whether original database tables in ExpData objects should be deleted.

verbose

Logical indicating whether details should be printed.

Value

An object of class ExpData containing data columns from all the original ExpData objects.

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
 7
 8
 9
10
11
12
13
14
15
16
N  <- 10000 # the number of observations. 
df1 <- 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))
df2 <- 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))

eDataRaw1 <- aggregateExpData(importToExpData(df1, dbFilename = "my.db",
                              tablename = "ex_tbl_1", overwrite = TRUE))
eDataRaw2 <- aggregateExpData(importToExpData(df1, dbFilename = "my.db",
                              tablename = "ex_tbl_2", overwrite = TRUE))
jd <- joinExpData(list(eDataRaw1, eDataRaw2), tablename = "combined", 
                  fields = list("ex_tbl_1" = c("counts" = "e1"),
                                "ex_tbl_2" = c("counts" = "e2")))
head(jd)    

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