op_diagram | R Documentation |
Build a diagram of a optree pipeline.
op_diagram(optree, ..., merge_tables = FALSE, show_table_columns = TRUE)
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. |
character DiagrammeR::grViz() ready text.
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")
# }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.