View source: R/get_tree_data.R
get_tree_data | R Documentation |
Extract and organize information from a random forest tree
get_tree_data(rf, k)
rf |
random forest model fit using randomForest |
k |
number identifying the tree in the random forest from which to extract information |
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.