How to do it…

  1. Launch R and open a new script by selecting File and then New script.
  2. In the R Editor window, enter the following code. Make sure to replace all of the file paths with the paths leading to the appropriate locations on your device. After pasting the paths, make sure to replace the backslashes with double backslashes, as in the following code block:
install.packages('rpart',repos='http://cran.us.r-project.org')library(rpart)cars <- read.table("C:\\!Slaven\\6 KNJIGA\\4 Advanced analytics\\4 decision tree\\new_or_used_car.csv", header=T, sep=",")fit <- rpart(FuturePurchase ~ Age + Gender + Education + FamilyStatus + CurrentCar + AgeOfCurrentCar + MunicipalityType, method="class", data=cars)plot(fit, uniform=TRUE, main="Classification ...

Get Tableau 2019.x Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.