Installing and Configuring RStudio

RStudio is a relatively new and shiny editor for R. It is our main choice of editor for this book as it is easy to use, has a decent help page and very good support, and incorporates R in a practical way. Ofcourse you are free to work with any text editor you like. In chapter 2 we discuss some alternatives.

Installing RStudio is as easy as going to RStudio download, clicking the Download RStudio Desktop button, selecting the installation file for your system, and running it. RStudio will be installed on your system and normally detects your latest installed R version automatically. If you didn’t do anything kinky, you should be able to use R from within RStudio without extra configuration.

Configuring RStudio

Sometimes, you want to use a different R version from the one RStudio selected. You may want to use R in a 64-bit context, for example. Or RStudio may not automatically recognize your installation of R. In that case, you can set which R version to use by choosing Tools @–> Options. Next to that, you can tweak the behavior of R in RStudio in this Options pane as well. If you click on the icon R general on the left, you get all the default options for R in RStudio.

Changing the version of R

To change the R version, click the Change button. In the resulting screen, you can switch between the default 32-bit or 64-bit R installation for your machine, or you can choose a specific version of R. RStudio lists all the versions it can find. If you click Browse, you can select the root directory for any R version you want to use. This folder normally looks something like …/R/R-n.n.n. In case you select an R version that both 32-bit and 64-bit builds, RStudio will ask you which build you want to use.

Changing other options

In the same Options pane, you can change several other settings:

  • You can set the default working directory R will use at startup.
  • You can set whether R saves your workspace never, always, or only if you agree. By default, RStudio asks you whether you want to save the workspace when you quit.
  • You can let RStudio restore the workspace automatically at startup. RStudio will look for a saved workspace in the root folder or the default working directory.
  • You can change the way RStudio saves the history. By default, RStudio always saves the history in a single global file.
  • You can set the CRAN mirror site that RStudio uses to install new packages (see Chapter 3).

Remember:  These settings work for R only from within RStudio. If you use R with another editor or by itself, the settings in RStudio will have no effect.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Get the book.

Recent Comments
Archives
Categories