Error: $ operator is invalid for atomic vectors

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Error: $ operator is invalid for atomic vectors

vidhiamin17
Here I will work on zomato data set. and I am trying to classify how many restaurants provide online delivery facility.

library(rpart) library(rpart.plot) fit1 <- rpart(Has.Online.delivery ~ Price.range + Aggregate.rating + Is.delivering.now + Has.Table.booking+Switch.to.order.menu, method = "class", parms = list(split = "gini"), data = zomatoDelhi)

pred1 <- predict(fit1, type="class") (conf.mat <- table(zomatoDelhi$Has.Online.delivery, pred1))

pred <- prediction(predict(fit1, type = "prob")[, 2],zomatoDelhi$Has.Online.delivery)

plot(performance(pred, "tpr", "fpr")) abline(0,1,lty=2)

When I am trying to run above code it gives me following error. I have already convert zomato data set into data frame. Error: $ operator is invalid for atomic vectors