Learn R Programming

lares (version 4.7)

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

See Also

Other Exploratory: corr_cross, corr_var, crosstab, df_str, distr, freqs_df, freqs, gain_lift, get_tweets, missingness, plot_cats, plot_df, plot_nums, trendsRelated

Other Visualization: corr_plot, distr, freqs_df, freqs, mplot_conf, mplot_cuts_error, mplot_cuts, mplot_density, mplot_full, mplot_gain, mplot_importance, mplot_lineal, mplot_metrics, mplot_response, mplot_roc, mplot_splits, noPlot, plot_survey, theme_lares2, theme_lares