get_tree_data: Extract and organize information from a random forest tree

View source: R/get_tree_data.R

get_tree_dataR Documentation

Extract and organize information from a random forest tree

Description

Extract and organize information from a random forest tree

Usage

get_tree_data(rf, k)

Arguments

rf

random forest model fit using randomForest

k

number identifying the tree in the random forest from which to extract information

Examples


# Load the Palmer penguins data
library(palmerpenguins)
penguins <- na.omit(penguins)

# Fit a random forest
set.seed(71)
penguin_rf <-
  randomForest::randomForest(
    species ~ bill_length_mm + bill_depth_mm + flipper_length_mm + body_mass_g,
    data = penguins
  )

# Extract tree data from the first tree in the random forest
get_tree_data(penguin_rf, 1)

goodekat/TreeTracer documentation built on April 19, 2023, 7:44 p.m.