Skip to contents

Utility function to make small directed acyclic graphs, using the data.tree package. Nodes are provided with randomly-selected numerical values.

Usage

make_val_tree(min_children = 1,
                     max_children = 4,
                     min_depth = 3,
                     values = 1:5,
                     fillcolor = "palegreen",
                     fontcolor = "black",
                     seed = NULL)

Arguments

min_children

Minimum number of children when node will not be a leaf.

max_children

Maximum number of children when node will not be a leaf.

min_depth

Nodes at less than this specified depth will not be leaves.

values

Numerical vector of possible values to associate with each node.

fillcolor

Fill color for nodes.

fontcolor

Fonot color for text showing node value and node name.

seed

Option to set the random seed.

Value

A tree object of class "Node" and "R6"

Author

Homer White homerhanumat@gmail.com

Examples

if (FALSE) { # \dontrun{
tr <- make_val_tree(
  values = 1:10,
  seed = 4040,
  fillcolor = "lightblue"
)
library(DiagrammeR)
plot(tr)
} # }