make_val_tree: Building Random Trees

View source: R/trees.R

make_val_treeR Documentation

Building Random Trees

Description

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(s)

Homer White homerhanumat@gmail.com

Examples

## Not run: 
tr <- make_val_tree(
  values = 1:10,
  seed = 4040,
  fillcolor = "lightblue"
)
library(DiagrammeR)
plot(tr)

## End(Not run)

homerhanumat/bcscr documentation built on Jan. 14, 2023, 4 a.m.