Skip to contents

If .data is empty an InducerRpart object will be created. If .data is a Dataset object a rpart model will be fitted.

Usage

InducerRpart(
  .data = NULL,
  formula,
  weights,
  subset,
  na.action = "na.rpart",
  method,
  model = FALSE,
  x = FALSE,
  y = TRUE,
  parms,
  control,
  cost
)

Arguments

.data

data object of class Dataset

formula

a formula, with a response but no interaction terms. If this is a data frame, it is taken as the model frame

weights

optional case weights.

subset

optional expression saying that only a subset of the rows of the data should be used in the fit.

na.action

the default action deletes all observations for which y is missing, but keeps those in which one or more predictors are missing.

method

one of "anova", "poisson", "class" or "exp". If method is missing then the routine tries to make an intelligent guess

model

if logical: keep a copy of the model frame in the result? If the input value for model is a model frame

x

keep a copy of the x matrix in the result.

y

keep a copy of the dependent variable in the result. If missing and model is supplied this defaults to FALSE.

parms

optional parameters for the splitting function.

control

a list of options that control details of the rpart algorithm

cost

a vector of non-negative costs, one for each variable in the model. Defaults to one for all variables

Value

a InducerRpart object

Examples

inducer <- InducerRpart()
inducer
#> Inducer: rpart
#> Configuration:  formula = , weights = , subset = , na.action = na.rpart, method = , model = FALSE, x = FALSE, y = TRUE, parms = , control = , cost = 
cars.data <- Dataset(data = cars, target = "dist")
fittedInd <- InducerRpart(.data = cars.data)
#> Error in na.rpart(structure(list(dist = c(2, 10, 4, 22, 16, 10, 18, 26, 34, 17, 28, 14, 20, 24, 28, 26, 34, 34, 46, 26, 36, 60, 80, 20, 26, 54, 32, 40, 32, 40, 50, 42, 56, 76, 84, 36, 46, 68, 32, 48, 52, 56, 64, 66, 54, 70, 92, 93, 120, 85), speed = c(4, 4, 7, 7, 8, 9, 10, 10, 10, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 16, 16, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 20, 20, 20, 20, 20, 22, 23, 24, 24, 24, 24, 25)), class = "data.frame", row.names = c(NA, 50L), terms = dist ~ speed)): could not find function "na.rpart"
fittedInd
#> Error in eval(expr, envir, enclos): object 'fittedInd' not found