op_diagram: Build a diagram of a optree pipeline.

Description Usage Arguments Value Examples

View source: R/op_diagram.R

Description

Build a diagram of a optree pipeline.

Usage

1
op_diagram(optree, ..., merge_tables = FALSE, show_table_columns = TRUE)

Arguments

optree

operation tree pipeline (or list of such).

...

force other argument to be by name.

merge_tables

logical, if TRUE merge all same table references into one node. rel_op nodes that declare a materialize_as name will be cross-linked.

show_table_columns

logical, if TRUE show table columns.

Value

character DiagrammeR::grViz() ready text.

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
d <- mk_td('d',
             columns = qc(AUC, R2))
optree <- d %.>%
  extend(., v %:=% ifelse(AUC>0.5, R2, 1.0)) %.>%
  quantile_node(.) %.>%
  natural_join(., d, jointype = "LEFT", by = "AUC") %.>%
  orderby(., "AUC")

cat(format(optree))

cat(op_diagram(optree))

if(requireNamespace("DiagrammeR", quietly = TRUE)) {
  optree %.>%
    op_diagram(., merge_tables = TRUE) %.>%
    DiagrammeR::grViz(.) %.>%
    print(.)
 # # or to render to png
 # optree %.>%
 #   op_diagram(., merge_tables = TRUE) %.>%
 #   DiagrammeR::DiagrammeR(diagram = ., type = "grViz") %.>%
 #     DiagrammeRsvg::export_svg(.) %.>%
 #     charToRaw(.) %.>%
 #     rsvg::rsvg_png(., file = "diagram1.png")
}

WinVector/rquery documentation built on Dec. 8, 2019, 3:51 a.m.