# NOT RUN {
## load weather data
data("WeatherPlay", package = "partykit")
WeatherPlay
## construct simple tree
pn <- partynode(1L,
split = partysplit(1L, index = 1:3),
kids = list(
partynode(2L,
split = partysplit(3L, breaks = 75),
kids = list(
partynode(3L, info = "yes"),
partynode(4L, info = "no"))),
partynode(5L, info = "yes"),
partynode(6L,
split = partysplit(4L, index = 1:2),
kids = list(
partynode(7L, info = "yes"),
partynode(8L, info = "no")))))
pn
## couple with data
py <- party(pn, WeatherPlay)
## print/plot/predict
print(py)
plot(py)
predict(py, newdata = WeatherPlay)
## customize printing
print(py,
terminal_panel = function(node) paste(": play=", info_node(node), sep = ""))
# }
Run the code above in your browser using DataLab