Learn R Programming

climbeR (version 0.0.1)

recursiveDepthBinning: Recursive Depth Binning

Description

Function to recursively traverse depths of a tree.

Usage

recursiveDepthBinning(node_list, depth, expected_num_children, binned_depths)

Arguments

node_list
Must be in the format of elements in the Ranger package's forest$split.varIDs, which represents one tree in the forest. Recursion is done by counting the number of terminal nodes at the current depth to anticipate the correct number of nodes at the next depth.
depth
Each recursive call must know the current depth in the tree.
expected_num_children
The number of nodes in the current depth must be anticipated, given the number of terminal nodes at the previous depth.
binned_depths
A list passed between recursive calls, to store results.

Value

A list of vectors, where elements correspond to depths, and vectors contain variable ID's of variables used to split at that depth.