Friday, February 10, 2012

managing projects using RStudio

We're continually amazed with new developments within RStudio, the integrated developed environment for R that we highlighted previously (Among others, Andrew Gelman agrees with us about its value).

The most recent addition addresses one of our earlier concerns, by adding support for projects within RStudio. These allow work to be divided into multiple contexts, each with their own working directory, workspace, history, and source documents. For those multi-taskers amongst us, this is a big win. Projects can be created within a new or existing directory, as well as through use of a version control system (Git or Subversion).

When you create or move to a project within RStudio lots of useful things happen:
(1) A new R session (process) is started
(2) The .Rprofile file in the project's main directory (if any) is sourced by R
(3) The .RData file in the project's main directory is loaded (this can be controlled by an option).
(4) The .Rhistory file in the project's main directory is loaded into the RStudio History pane (and used for Console Up/Down arrow command history).
(5) The current working directory is set to the project directory.
(6) Previously edited source documents are restored into editor tabs, and
(7) Other RStudio settings (e.g. active tabs, splitter positions, etc.) are restored to where they were the last time the project was closed.

If you haven't updated your version of RStudio recently, or have never checked it out, this would be a great time to consider it. More information about these new features can be found here, along with an excellent screencast overview here. Happy coding!