Learn R Programming

lares (version 4.10.6)

tree_var: Recursive Partitioning and Regression Trees

Description

Fit and plot a rpart model for exploratory purposes using rpart and rpart.plot libraries. Idea from explore library.

Usage

tree_var(
  df,
  target,
  max = 3,
  min = 20,
  cp = 0,
  size = 0.7,
  ohse = TRUE,
  plot = TRUE,
  ...
)

Arguments

df

Data frame

target

Variable

max

Integer. Maximal depth of the tree

min

Integer. The minimum number of observations that must exist in a node in order for a split to be attempted

cp

Numeric. Complexity parameter

size

Numeric. Textsize of plot

ohse

Boolean. Auto generate One Hot Smart Encoding?

plot

Boolean. Return a plot? If not, rpart object

...

rpart.plot custom parameters

Value

When plot=TRUE returns plot; when plot=FALSE returns rpart fitted model.

See Also

Other Exploratory: corr_cross(), corr_var(), crosstab(), df_str(), distr(), freqs_df(), freqs_list(), freqs_plot(), freqs(), lasso_vars(), missingness(), plot_cats(), plot_df(), plot_nums(), trendsRelated()

Other Visualization: distr(), freqs_df(), freqs_list(), freqs_plot(), freqs(), gg_bars(), gg_pie(), noPlot(), plot_chord(), plot_survey(), plot_timeline(), theme_lares()