i have time series data like this :
and i want to do decision tree classification and prediction , which is my Y(dependent) is open and others is X's(independent), this is my coding :
library(rpart)
library(rpart.plot)
tree <- rpart(close ~., data = DCovid, method = "anova")
tree
rpart.plot(tree)
predict_unseen <-predict(tree, DCovid , type = 'class'):
but the syntax :
predict_unseen <-predict(tree, DCovid , type = 'class')
Error in predict.rpart(tree, DCovid, type = "class") :
Invalid prediction for "rpart" object
can anyone help me on prediction