ra_plot_tree: Plot a model tree from a quantrra table

View source: R/ra_plot_tree.R

ra_plot_treeR Documentation

Plot a model tree from a quantrra table

Description

A traditional representation of the model table is plotted using the library DiagrammeR. This function expects as an input a list object with named elements as nodes and edges, corresponding to the tables specifying the nodes of the tree and connections between them Shape and Color for the nodes are obtained directly from variables in the nodes table. If missing, default colors and shape are used

Usage

ra_plot_tree(
  m,
  fontColor = "black",
  shape = "rectangle",
  static = T,
  edit = F,
  edgetbl = F,
  fitlabels = T,
  maxchar = 10,
  direction = "LR"
)

Arguments

m

Model table with columns id, label, type, distribution and formula see examples.

fontColor

Color of the text displayed in the figure

shape

shape of the nodes, options are the same from the DiagrammeR library: ellipse, oval, diamond, egg, plaintext, point, square, triangle

static

if TRUE, the figure will be created with DiagrammeR for a static visualization. When FALSE, visNetwork is used for a dynamic visualization

edgetbl

if TRUE, return a table of edges for visualization purposes

fitlabels

if TRUE, automatically add breaks to fit the label bsed on the maxchar argument

maxchar

when fitlables = TRUE, maximum number of characters before the breaks

direction

direction for the visualization when using visNetwork interactive, options include: UD, DU, LR, RL; corresponding to: up-down, down-up, left-right, and right-left, respectively

Value

a grViz/htmlwidget figure representing the risk assessment tree

Examples

# Use one of the examples from the library
m <- quantrra::OIRSA
ra_plot_tree(m)


jpablo91/QuantRRA documentation built on July 3, 2024, 10:46 p.m.