Go to TogaWare.com Home Page. Data Science Desktop Survival Guide
by Graham Williams
Duck Duck Go

Party Tree

The party package can be used to draw rpart decision trees using as.party() from partykit which can be installed from R-Forge:

install.packages("partykit", repos="http://R-Forge.R-project.org")
library(partykit)

class(model)
## [1] "rpart"

plot(as.party(model))

\includegraphics[width=\textwidth]{figures/onepager/unnamed-chunk-41-1}

The textual presentation of an rpart decision tree can also be improved using party.

print(as.party(model))
## 
## Model formula:
## rain_tomorrow ~ rain_today + temp_3pm + temp_9am + cloud_3pm + 
##     cloud_9am + pressure_3pm + pressure_9am + humidity_3pm + 
##     humidity_9am + wind_speed_3pm + wind_speed_9am + wind_dir_3pm + 
##     wind_dir_9am + wind_gust_speed + wind_gust_dir + sunshine + 
##     evaporation + rainfall + max_temp + min_temp
## 
## Fitted party:
## [1] root
## |   [2] humidity_3pm < 71.5: No (n=104517, err=13.7%)
## |   [3] humidity_3pm >= 71.5
## |   |   [4] humidity_3pm < 83.5
## |   |   |   [5] rain_today in No: No (n=6557, err=36.7%)
## |   |   |   [6] rain_today in Yes: Yes (n=4707, err=38.5%)
....


Support further development by purchasing the PDF version of the book.
Other online resources include the GNU/Linux Desktop Survival Guide.
Books available on Amazon include Data Mining with Rattle and Essentials of Data Science.
Popular open source software includes rattle and wajig.
Hosted by Togaware, a pioneer of free and open source software since 1984.
Copyright © 2000-2020 Togaware Pty Ltd. . Creative Commons ShareAlike V4.