plot_e2tree_click: Interactive E2Tree Plot for R Graphics Device

View source: R/plot_e2tree_click.R

plot_e2tree_clickR Documentation

Interactive E2Tree Plot for R Graphics Device

Description

Displays an E2Tree as an interactive plot in the R graphics device. Click on nodes to see detailed information in the console. Right-click or press ESC to exit interactive mode.

Usage

plot_e2tree_click(
  fit,
  data,
  ensemble,
  main = "E2Tree - Click on nodes (ESC to exit)",
  ...
)

Arguments

fit

An e2tree object

data

The training data used to build the tree

ensemble

The ensemble model (randomForest or ranger)

main

Plot title (default: "E2Tree - Click on nodes (ESC to exit)")

...

Additional arguments passed to rpart.plot

Details

This function converts the e2tree object to an rpart object and displays it using rpart.plot. You can then click on any node to see:

  • Node ID and type (terminal/internal)

  • Number of observations

  • Prediction and probability/purity

  • Decision path to reach the node

  • Class distribution (for classification)

  • Split rule (for internal nodes)

  • Observations in the node (for terminal nodes)

Value

Invisibly returns the rpart object

Examples


# After creating an e2tree object (requires interactive session)
if (interactive()) {
  plot_e2tree_click(tree, training, ensemble)
}



e2tree documentation built on May 15, 2026, 5:06 p.m.