[R] Rpart query

jagdeesh_mn jagz8595 at gmail.com
Tue Oct 12 08:24:06 CEST 2010


Hi,

Being a novice this is my first usage of R.

I am trying to use rpart for building a decision tree in R. And I have the
following dataframe 


Outlook	Temp	Humidity	Windy	Class
Sunny	75	70	Yes	Play
Sunny	80	90	Yes	Don't Play
Sunny	85	85	No	Don't Play
Sunny	72	95	No	Don't Play
Sunny	69	70	No	Play
Overcast	72	90	Yes	Play
Overcast	83	78	No	Play
Overcast	64	65	Yes	Play
Overcast	81	75	No	Play

The first line indicating the header. When I use the formula,

"CART<-rpart(Class ~ Outlook + Temp + Humidity + Windy, data=dataframe)"

and trying to plot the values of CART using plot(CART), I get the following
error,

"Error in plot.rpart(CART) : fit is not a tree, just a root".

Am I missing something here? Any help would be greatly appreciated. Btw, the
dataframe was obtained by reading a csv which shouldn't be an issue. 

-Jagdeesh


-- 
View this message in context: http://r.789695.n4.nabble.com/Rpart-query-tp2991198p2991198.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list