Teaching with RStudio
The RStudio IDE is a central component of the R software ecology that makes it easier to code in R, or to use R with other tools. This note discusses its use in a teaching environment.
Most of my teaching experience lies with Stata, but in recent years, I have also experimented teaching with R and RStudio to both undergraduate and postgraduate students, all of them from the social sciences.
My experience so far tells me that, when properly motivated, even those students who are either computer-illiterate and/or averse to statistics can end up knowing how to use RStudio to replicate example R scripts. Many things could however run more smoothly.
Setup issues
The following installation tasks can be very time-consuming to accomplish in class, especially when students are using a weak Wi-Fi connection (quite a common scenario in universities with many separate buildings).
Installing the software
Some students come to class with a tablet, thinking that it is equivalent to a laptop, and that they will manage to install whatever software is required for the course on it. Some other students using Windows will lack the proper privileges to install the software, or to install additional R packages later on.
In both situations, which are consequential to the ~~coming~~ war on general-purpose computing, students sadly tend to blame R and/or RStudio for the limitations enforced by the computing industry on their hardware and operating systems.
Perhaps setting up an RStudio Server instance is the best short-term solution to circumvent these issues, as well as the next ones below. This, however, requires some server equipment and an excellent Wi-Fi access point. It also means that students do not keep a local copy of the software for later use, which can be a teaching objective.
Installing R packages
Many of my students get to use the install.packages
very early in their experience with R and RStudio, because I like to expedite all package installation steps during the first classes. However, many students are baffled by the output of that function:
- Both R and RStudio show messages in the same color as warnings and errors (which happens to be red by default). As a result, students cannot rely on color to diagnose whether the installation process has succeeded.
- Right now, at least on Mac OS X, RStudio does not show downloads in progress through a progress bar, but through (badly aligned) "% Total, % Received, etc." text that fills up the Console.
Both issues might get resolved by later versions of RStudio, but ideally, I would also like the install.packages
function to end with a more helpful message, such as an indication of how to load the package.
Application improvements
A few additional features would help using RStudio in teaching environments. On that topic, see also this thread at the RStudio Support website.
Default settings
The RStudio program defaults do not require many tweaks to work fine in a teaching environment. The only settings that I always ask students to modify after installation are those that control the workspace, which I never require to have them save.
The single option that I miss is a default setting to force the user to set up the working directory when RStudio launches. Given the number of students who forget that step (which also happens when teaching Stata), this setting would have great teaching value.
I would also value the possibility to lock a file from within RStudio. This might sound strange, but so many students will press Enter
instead of Ctrl-Enter
when asked to run code that it would also save some time with them.
Keyboard shortcuts
It is tremendously helpful to be able to use shortcuts for stuff like setting the working directory and clearing the Console. In addition existing shortcuts, I would also like to use shortcuts to
- toggle the "Source on Save" checkbox
- zoom the last plot shown in the "Plots" pane
- hide or show the right-hand panes
The last shortcut in particular might help with using RStudio while connected to a projector that can only show low-resolution displays. Perhaps a keyboard shortcut to zoom-and-maximize the plot would also help with that.
Additional documentation
As of now, the "Help" pane of RStudio is used only to show R documentation pages, and the documentation that shows up on the home page of that pane is generally too difficult for R beginners.
I wonder how hard it would be to have the "Help" pane to show other forms of documentation, such as "learn the basics" tutorials or even video screencasts. If the "Help" pane cannot render these, perhaps the "Viewer" pane might.
The idea here would be to offer a series of tutorials that users would download from external sources and then run from within the RStudio application. These tutorials would be very easy to assign as homework.
- First published on December 14th, 2015