[R] Problem with create a tree

Grześ gregorio99 at gmail.com
Sun Apr 26 18:04:21 CEST 2009


I have a small database (file csv):

'District';'HouseType';'Income';'PreviousCustomer';'Outcome'
'Suburban';'Detached';'High';'No';'Nothing'
'Suburban';'Detached';'High';'Yes';'Nothing'
'Rural';'Detached';'High';'No';'Responded' ....... itd.

After instruction str() as a result I get:

> str(zielone)
'data.frame': 14 obs. of 5 variables:
$ X.District. : Factor w/ 3 levels "'Rural'","'Suburban'",..: 2 2 1 3 3 3 1
2 2 3 ...
$ X.HouseType. : Factor w/ 3 levels "'Detached'","'Semi-detached'",..: 1 1 1
2 2 2 2 3 2 3 ...
$ X.Income. : Factor w/ 2 levels "'High'","'Low'": 1 1 1 1 2 2 2 1 2 2 ...
$ X.PreviousCustomer.: Factor w/ 2 levels "'No'","'Yes'": 1 2 1 1 1 2 2 1 1
1 ...
$ X.Outcome. : Factor w/ 2 levels "'Nothing'","'Responded'": 1 1 2 2 2 1 2 1
2 2 ...

But when I try to built a tree I get an error. What's wrong in my file?

> t.zielone=rpart(zielone$X.District~.,zielone)
> plot(t.zielone)
Error in plot.rpart(t.zielone) : fit is not a tree, just a root

-- 
View this message in context: http://www.nabble.com/Problem-with-create-a-tree-tp23243589p23243589.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list