[R] Specification of model formulae

Christian Hennig fm3a004 at math.uni-hamburg.de
Fri Apr 16 17:08:39 CEST 2004


Hi,

is it true that the only way to tell rpart which variables to use
is to specify every single variable in the formula and separate them with
"+"?

I wonder if this error...

> rotree <- rpart(powerdata[,1]~powerdata[,2:3],
+                      method="class")
Error in model.frame(formula, rownames, variables, varnames, extras,
extranames,  : 
	invalid variable type

...can be prevented by other means than...

> rotree <- rpart(segments~V1.3+V1.9,
+                      method="class",data=powerdata)

This works.
(The variables here are powerdata[,1] and [,2:3].)

But I do not want to write 200 variable names down, as this is the real
size of "powerdata".

Is there any way around that?

Christian



***********************************************************************
Christian Hennig
Fachbereich Mathematik-SPST/ZMS, Universitaet Hamburg
hennig at math.uni-hamburg.de, http://www.math.uni-hamburg.de/home/hennig/
#######################################################################
ich empfehle www.boag-online.de




More information about the R-help mailing list