Render a tree as a graph

renderTreeAsGraph(
  tree,
  theme = metabefor::defaultGraphTheme(),
  returnDot = FALSE
)

Arguments

tree

The tree

theme

The theme

returnDot

Whether to return the specification in Dot.

Value

The result of DiagrammeR::render_graph(), or, if returnDot=TRUE, a character vector with the specification in Dot.

Examples

### Load an example Rxs project
data('example_rxsProject_1', package="metabefor");

### Show the tree for one source as a graph
metabefor::renderTreeAsGraph(
  example_rxsProject_1$rxsTrees$qurid_7h50rzpq
);
### You can also return the produced Dot specification dot <- metabefor::renderTreeAsGraph( example_rxsProject_1$rxsTrees$qurid_7h50rzpq, returnDot=TRUE ); ### Show it (and maybe tweak it) cat(dot); #> digraph { #> #> graph [fontname = 'Arial', #> layout = 'dot', #> rankdir = 'LR', #> outputorder = 'edgesfirst'] #> #> node [fontname = 'Arial', #> fixedsize = 'false', #> shape = 'box', #> style = 'filled', #> color = '#000000', #> fillcolor = '#FFFFFF'] #> #> edge [fontname = 'Arial', #> color = '#888888', #> dir = 'none', #> headclip = 'false', #> tailclip = 'false'] #> #> '1' [label = 'source'] #> '2' [label = 'general'] #> '3' [label = 'publicationYear'] #> '4' [label = 'sourceAuthors'] #> '5' [label = 'sourceTitle'] #> '6' [label = 'modeInfo'] #> '7' [label = 'methods'] #> '8' [label = 'sample'] #> '9' [label = 'sampleSize'] #> '10' [label = 'samplingStrategy'] #> '11' [label = 'method'] #> '12' [label = 'variables'] #> '13' [label = 'chalk'] #> '14' [label = 'witches'] #> '15' [label = 'crayons'] #> '16' [label = 'instruments'] #> '17' [label = 'associations'] #> '18' [label = 'chalk_and_witches'] #> '1'->'2' #> '1'->'7' #> '1'->'17' #> '2'->'3' #> '2'->'4' #> '2'->'5' #> '2'->'6' #> '7'->'8' #> '7'->'11' #> '7'->'12' #> '7'->'16' #> '17'->'18' #> '8'->'9' #> '8'->'10' #> '12'->'13' #> '12'->'14' #> '12'->'15' #> }