Skip to contents

Predict from the results of a rpart model

Usage

# S3 method for ModelRpart
predict(object, newdata, ...)

Arguments

object

a linear model of class ModelRpart

newdata

data of class data.frame or Dataset

...

additional arguments

Value

An object with the predictions of class numeric or data.frame

Examples

cars.data <- Dataset(data = cars, target = "dist")
inducer <- InducerLm()
rpartfit <- fit.InducerRpart(.inducer = inducer, .data = cars.data)
#> Error in fit.InducerRpart(.inducer = inducer, .data = cars.data): could not find function "fit.InducerRpart"
predict.ModelRpart(object = rpartfit, newdata = data.frame(speed = 10))
#> Error in predict.ModelRpart(object = rpartfit, newdata = data.frame(speed = 10)): could not find function "predict.ModelRpart"
predict.ModelRpart(object = rpartfit, newdata = cars.data[c(1, 2, 3, 4), ])
#> Error in predict.ModelRpart(object = rpartfit, newdata = cars.data[c(1,     2, 3, 4), ]): could not find function "predict.ModelRpart"