Fit is not a tree, just a root

I am very new to R and I am trying to create a decision tree where I have variables high blood pressure, diabetes, hyperlipemia and I want it to predict if you will be overweight.

I have changed my data from yes and no to 1 and 0 and it still doesn't help. my sample dataset is 10000 rows and here is my code

dtdata<- read.csv(file="C:\\Desktop\\School\\D209\\overweightv2.csv")
plot(dtdata)
dt_train <- dtdata[1:8999, ]
dt_test <- dtdata[9000:10000, ]
require(rpart)
dtm <- rpart(Overweight~., dt_train, method="class")
dtm
plot(dtm)

everything works until I get to the plot. Once I plot I get the error "fit is not a tree, just a root"

can you describe what it is you are hoping to plot ? what the plot should look like ?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.