executeLeftJoinPlan: Execute an ordered sequence of left joins.

Description Usage Arguments Value See Also Examples

Description

Please see vignette('DependencySorting', package = 'replyr') and vignette('joinController', package= 'replyr') for more details.

Usage

1
2
3
4
5
executeLeftJoinPlan(tDesc, columnJoinPlan, ..., checkColumns = FALSE,
  computeFn = function(x, name) {     dplyr::compute(x, name = name) },
  eagerCompute = TRUE, checkColClasses = FALSE, verbose = FALSE,
  dryRun = FALSE,
  tempNameGenerator = mk_tmp_name_source("executeLeftJoinPlan"))

Arguments

tDesc

description of tables, either a data.frame from tableDescription, or a list mapping from names to handles/frames. Only used to map table names to data.

columnJoinPlan

columns to join, from buildJoinPlan (and likely altered by user). Note: no column names must intersect with names of the form table_CLEANEDTABNAME_present.

...

force later arguments to bind by name.

checkColumns

logical if TRUE confirm column names before starting joins.

computeFn

function to call to try and materialize intermediate results.

eagerCompute

logical if TRUE materialize intermediate results with computeFn.

checkColClasses

logical if true check for exact class name matches

verbose

logical if TRUE print more.

dryRun

logical if TRUE do not perform joins, only print steps.

tempNameGenerator

temp name generator produced by wrapr::mk_tmp_name_source, used to record dplyr::compute() effects.

Value

joined table

See Also

tableDescription, buildJoinPlan, inspectDescrAndJoinPlan, makeJoinDiagramSpec

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# example data
meas1 <- data.frame(id= c(1,2),
                    weight= c(200, 120),
                    height= c(60, 14))
meas2 <- data.frame(pid= c(2,3),
                    weight= c(105, 110),
                    width= 1)
# get the initial description of table defs
tDesc <- rbind(tableDescription('meas1', meas1),
               tableDescription('meas2', meas2))
# declare keys (and give them consitent names)
tDesc$keys[[1]] <- list(PatientID= 'id')
tDesc$keys[[2]] <- list(PatientID= 'pid')
# build the column join plan
columnJoinPlan <- buildJoinPlan(tDesc)
# decide we don't want the width column
columnJoinPlan$want[columnJoinPlan$resultColumn=='width'] <- FALSE
# double check our plan
if(!is.null(inspectDescrAndJoinPlan(tDesc, columnJoinPlan,
            checkColClasses= TRUE))) {
  stop("bad join plan")
}
# execute the left joins
executeLeftJoinPlan(tDesc, columnJoinPlan,
                    checkColClasses= TRUE,
                    verbose= TRUE)
# also good
executeLeftJoinPlan(list('meas1'=meas1, 'meas2'=meas2),
                    columnJoinPlan,
                    checkColClasses= TRUE,
                    verbose= TRUE)

replyr documentation built on Nov. 1, 2019, 7:49 p.m.