# Classification Tree with rpart
library(rpart)

# grow tree
fit <- rpart(y~ x1 + x2+ x3 + x4+ x5,method="class", data=data)


printcp(fit) # display the results
plotcp(fit) # visualize cross-validation results
summary(fit) # detailed summary of splits

# plot tree
plot(fit, uniform=TRUE,main="Classification Tree for data")
text(fit, use.n=TRUE, all=TRUE, cex=.8)

# create attractive postscript plot of tree
post(fit, file = "c:/tree.ps",title = "Classification Tree for data")


> plotcp(fit)
Erreur dans plotcp(fit) :
  'cptable' ne contients aucuns résultats de validation croisée

> summary(fit)
Call:
rpart(formula = y~ x1 + x2 + x3 +x4 +x5,
    data = data, method = "class")
  n=2091 (631 observations deleted due to missingness)

  CP nsplit rel error
1  0      0         1
Erreur dans yval[, 1] : nombre de dimensions incorrect


->> Someone can help to solve this problem.
Thanx

	[[alternative HTML version deleted]]

