Learn R Programming

replyr (version 0.8.2)

makeJoinDiagramSpec: Build a drawable specification of the join diagram

Description

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

Usage

makeJoinDiagramSpec(columnJoinPlan, ..., groupByKeys = TRUE,
  graphOpts = NULL)

Arguments

columnJoinPlan

join plan

...

force later arguments to bind by name

groupByKeys

logical if true build key-equivalent sub-graphs

graphOpts

options for graphViz

Value

grViz diagram spec

See Also

tableDescription, buildJoinPlan, renderJoinDiagram, executeLeftJoinPlan

Examples

Run this code
# NOT RUN {

# note: employeeanddate is likely built as a cross-product
#       join of an employee table and set of dates of interest
#       before getting to the join controller step.  We call
#       such a table "row control" or "experimental design."

my_db <- dplyr::src_sqlite(":memory:",
                           create = TRUE)
tDesc <- replyr:::example_employeeAndDate(my_db)
# fix order by hand, please see replyr::topoSortTables for
# how to automate this.
ord <- match(c('employeeanddate', 'orgtable', 'activity', 'revenue'),
             tDesc$tableName)
tDesc <- tDesc[ord, , drop=FALSE]
columnJoinPlan <- buildJoinPlan(tDesc, check= FALSE)
# unify keys
columnJoinPlan$resultColumn[columnJoinPlan$resultColumn=='id'] <- 'eid'
# look at plan defects
print(paste('problems:',
            inspectDescrAndJoinPlan(tDesc, columnJoinPlan)))
diagramSpec <- makeJoinDiagramSpec(columnJoinPlan)
# to render as JavaScript:
#   DiagrammeR::grViz(diagramSpec)
# or as a PNG:
#   renderJoinDiagram(diagramSpec)
#
DBI::dbDisconnect(my_db$con)
my_db <- NULL

# }

Run the code above in your browser using DataLab