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"