I did a screencast for my co-workers to show how to get started with R, specifically what a base installation of R looks like, then showing how to improve your workflow using RStudio, Rcmdr or rattle. The examples are somewhat pedestrian, but it gives a feel for what using R actually looks like.
If you have any questions, comments, or jeers about how bad I am at R, feel free to leave a comment in the comments section!
In my first post in this series, I discussed RStudio, an IDE that adds significant functionality and consistency to a basic installation of R. In this post, I will discuss Rcmdr, a GUI that provides the ability to do basic business statistics without having to code in R.
Rcmdr (“R Commander”)
Example Rcmdr window with the "Statistics" menu expanded
Rcmdr is a package for R that was created by John Fox at McMaster University in Canada as a means of providing the basic statistics functionality for classroom use. In this way, Rcmdr is somewhat similar to SAS Enterprise Guide, a GUI that allows quick access to the power of SAS without the requirement of writing code.
While using Rcmdr won’t allow you to tap into every single advanced feature that R provides, it does provide a lot of great “general” functionality that can be used in everyday business such as summary statistics, t-tests, ANOVA, linear regression modeling, graphing and data re-coding.
For the most part, the Rcmdr dialog boxes all look very similar. Only the most useful options are provided, such as the variable(s) you are looking to interrogate, variable(s) you’d like to break down your analysis by, what statistics you want the output to display (mean, median, mode, etc.) and so on. The dialog boxes vary depending on whether you are estimating a model or plotting a graph, but in my preliminary usage I haven’t found any dialog boxes that were so confusing that I needed to check the “Help” files.
For example, suppose I wanted to make a boxplot of my data, income by job type. To do so, I would go to the “Graphs” menu and select “Boxplot”, which provides me with the following dialog box:
Rcmdr options for creating a Boxplot
Boxplot output created by Rcmdr
Within this dialog box, there are only 3 choices: variable to plot (income), variable to break down the graph by (type), and “Identify outliers with mouse”, which allows for the user to point at the resulting graph to designate outliers to be labeled on the graph. When I click “OK” in the dialog box, the result is the boxplot shown above. We can see that the “bc” (blue-collar) group has a lower mid-point to the income range than “prof” (professors) and “wc” (white-collar).
One of the best features of Rcmdr is that not only do we get the output we requested, but the code window also shows the code that was necessary to create the boxplot. In this example, the underlying R code is relatively simple:
By providing the underlying code, Rcmdr serves as a teaching tool to move the beginning user towards coding in R directly, or at least, modifying the tool-generated code to include titles or whatever options the user wants to add to the original analysis/output.
Installation of Rcmdr
Sadly, Rcmdr is one of those add-ins that seems to work better on Windows than Mac OSX, at least for the installation portion. I’ve been able to successfully install Rcmdr on my relatively old MacBook Pro, but it did take a bit of time to figure out. Luckily, the instructions to install Rcmdr on a Mac are fairly well laid out in this article.
However, once you get over the hurdle of downloading tcltk and XQuartz (X11 emulator), the program seems to work the same on both platforms.
Despite my preference for SAS over R, there are some add-ons to “basic” R that I’ve found that have made my learning process way easier. While I’m still in my infancy in learning R, I feel like once I found these additional tools, my ability to use R to get work done improved significantly.
In this first post of three, I’ll discuss RStudio, a more friendly access point to the default installation of R. My second post will discuss Rcmdr, a GUI developed for students taking a basic college-level course in Statistics. The third post will cover rattle, a GUI specifically designed for data mining (as opposed to more general statistics like Rcmdr).
R Studio is an IDE that dramatically improves the R experience
RStudio is an open-source Integrated Development Environment (IDE) that provides a more consistent user experience to R. There are many great features of RStudio over “basic” R, including:
Consistent windowing between sessions (customizable by the user)
Point-and-click exploration of data frames and other data objects
Importing data files through dialog box functionality
Customizable code syntax highlighting, auto-complete, and Help menu access from the code editor
Ability to see all installed packages, turn on packages using a checkbox, and download libraries (and their dependencies) without having to write any code
Version Control using GitHub
While RStudio doesn’t provide a GUI that will help you run a regression model or build a graph, it provides a more “friendly” environment to work in as compared to the command-line interface of a default installation of R. I find that by having elements like the currently active data objects and available/active packages with links to the Help files “exposed” at all times, RStudio reminds me of where my analysis has been and gives me a quick way to think about “What Else?” to pursue if I hit a roadblock.
Installation of RStudio
RStudio installs like any other program for Windows or Mac OSX. As far as I can tell, there are no advantages to using RStudio in either environment, both the Windows and OSX versions seem to work equally well. The most important consideration is that RStudio is just an “add-on” so-to-speak, it does not include R itself. So be sure to go to one of the Comprehensive R Archive Network (CRAN) sites to download R first.