# NOT RUN {
library(macs)
set.seed(1234)
data <- data.frame(y = sample(1:3, 1000, replace = TRUE),
n = sample(1:4, 1000, replace = TRUE,
prob = c(0.1, 0.3, 0.2, 0.4)),
o1 = sample(1:50, 1000, replace = TRUE),
o2 = sample(1:30, 1000, replace = TRUE),
o3 = sample(1:10, 1000, replace = TRUE),
o4 = sample(1:60, 1000, replace = TRUE),
o5 = sample(1:20, 1000, replace = TRUE),
o6 = sample(1:40, 1000, replace = TRUE))
data[,2] <- as.factor(data[,2])
result <- rtree(data, method = "entropy", alpha = 0.01, cost = NULL)
plot(result)
# }
Run the code above in your browser using DataLab