op_diagram: Build a diagram of a optree pipeline.

View source: R/op_diagram.R

op_diagramR Documentation

Build a diagram of a optree pipeline.

Description

Build a diagram of a optree pipeline.

Usage

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


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")
# }


rquery documentation built on Aug. 20, 2023, 9:06 a.m.