View source: R/decision_tree-rpartScore.R
| rpartScore_wrapper | R Documentation |
rpartScoreA 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.
rpartScore_wrapper(formula, data, ...)
formula |
The formula to pass. |
data |
The data frame to pass. |
... |
Additional arguments to pass. |
An object of S3 class rpart as returned by
rpartScore::rpartScore().
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
) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.