[This article was first published on triKnowBits
, and kindly contributed to R-bloggers
]. (You can report issue about the content on this page here
Want to share your content on R-bloggers? click here
if you have a blog, or here
if you don't.
At the Ratemaking and Product Management (RPM) seminar of the Casualty Actuarial Society (CAS) in San Diego last month, Linda Brobeck, Peggy Brinkmann, and yours truly gave a concurrent session on a machine learning technique called decision tree analysis. See the DSPA-2 session — and other sessions — at this link. Technical issues precluded showing the video of installing and running Rattle within RStudio. Thus this post.
As Peggy notes, installing and running Rattle takes only three “commands” in R:
install.packages(“rattle”, dependencies=c(‘Depends’, “Suggests”))
Although not necessary, the “Suggests” option above can avoid Rattle’s annoying requests for more packages as you click through its GUI; the downside is the time to download and install about 900 packages. Below (“Read more >>”) is a link to a video of me running through the three lines above:
For those whose IT departments restrict installing R and RStudio on company equipment, this presentation used the software on a USB drive. The first minute or so of the video shows me setting up the shortcut on the USB drive so RStudio runs without a bunch of confusing questions, especially for a newbie. If you have R and RStudio installed on your computer already, you can fast forward through the first minute.
Peggy put her three lines of code into a script called ‘Rattle.R’. That’s the file I double-click around the 1:10 mark. You can see the three lines of the script in the upper left pane of RStudio.
I run the first line starting at 8:17 am, which finishes at 9:32 am (the 1:42 mark in the video). Plenty of time to read the newspaper.
Then I run the second line which, despite the “Depends” and “Suggests” settings above, has to download and install yet another package, GTK+. (There are reasons why that’s necessary, but not important right now.) That takes just a few minutes.
Then I run the third line, which fires up the Rattle user interface (GUI). It’s a little hard to see, but the Rattle GUI shows up as another process running in the taskbar.
At this point you can start using rattle/rpart per Peggy’s presentation. The links to our three presentations are reproduced here for convenience: