rpart objects are created from the rpart package, which is used for recursive partitioning for classification, regression and survival trees.
Examples
# An rpart object
wrapped_rpart <- function() {
require("rpart")
some_junk_in_environment <- runif(1e6)
fit <- rpart(Kyphosis ~ Age + Number + Start,
data = kyphosis,
x = TRUE, y = TRUE)
return(fit)
}
# Remove junk
cleaned_rpart <- axe_env(wrapped_rpart(), verbose = TRUE)
#> ✔ Memory released: 9.56 MB
# Check size
lobstr::obj_size(cleaned_rpart)
#> 53.42 kB
