- Launch R and open a new script by selecting File and then New script.
- 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 ...