rpartScore_wrapper: Fit wrapper for 'rpartScore'

View source: R/decision_tree-rpartScore.R

rpartScore_wrapperR Documentation

Fit wrapper for rpartScore

Description

A wrapper is used because the model interface requires the response variable to be numeric rather than ordered or factor; the wrapper edits the input data accordingly.

Usage

rpartScore_wrapper(formula, data, ...)

Arguments

formula

The formula to pass.

data

The data frame to pass.

...

Additional arguments to pass.

Value

An object of S3 class rpart as returned by rpartScore::rpartScore().

Examples


house_data <-
  MASS::housing[rep(seq(nrow(MASS::housing)), MASS::housing$Freq), -5]
# subsample to reduce runtime
house_data <- house_data[sample(nrow(house_data), nrow(house_data) / 5), ]
# fit wrapper
( fit_orig <- rpartScore::rpartScore(
  formula = Sat ~ Infl + Type + Cont,
  data = transform(house_data, Sat = as.integer(Sat))
) )
( fit_wrap <- rpartScore_wrapper(
  formula = Sat ~ Infl + Type + Cont,
  data = house_data
) )


ordered documentation built on Nov. 23, 2026, 9:08 a.m.