create_subtree: Create a subtree dataframe

View source: R/trees.R

create_subtreeR Documentation

Create a subtree dataframe

Description

Create a subtree dataframe.

Usage

create_subtree(parents, specs, level)

Arguments

parents

Integer() with parent's ids.

specs

List of tree specs.

level

The tree level.

Details

Create a subtree dataframe used to build a tree with integer as id.

Value

Dataframe with subtree.

Examples

root <- 1L
specs <- list(
 l1 = list(digits = 100, nnodes = 9),
 l2 = list(digits = 100, nnodes = 19),
 l3 = list(digits = 100, nnodes = 29))
df <- data.frame(
 parent = root,
 child = root,
 level = 0L)
 out <- create_subtree(parents = df$child, specs[[1]], level = 1)
stopifnot((nrow(out) == specs[[1]]$nnodes))

FrankLef/eflTools documentation built on May 4, 2024, 10:04 p.m.