[R] Tree package on R 1.4.1

baba@muj.biglobe.ne.jp baba at muj.biglobe.ne.jp
Tue Apr 23 11:35:22 CEST 2002

Dear R-users

I would like to apply classification and regression tree(CART) to the following data. 
I have some question on using 'tree' package.
The data contains one response variable Y and five explanatory variables.
The explanatory variable "x2" is categorical and not ordinal.
But, the result obtained after running following R code 
has indicated that x2 is regard as continuous variable.
I think that CART procedure can be available to categorical and continuous variables.

How can I correct the R code such that x2 is regard as categorical and not ordinal?
By all means, reply me your suggestion or comments.

Thanks and best regards,

----------beginning  of R code --------------------
inputlist <- list(Y=0, x1=0, x2=0, x3=0,x4=0,x5=0)
# inputlist <- list(Y=0, x1=0, x2="", x3=0,x4=0,x5=0)
Ex6 <- scan("c:\\data\\CART\\EX6.txt",inputlist)
Ex6.ltr <- tree(Y ~ x1 + x2 +x3 + x4 +x5 ,Ex6)
----------end of R code ---------------------------

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list