3.2 RStudio

This course assumes the learner is using the RStudio software platform for all analyses, unless otherwise noted. RStudio is a freely available and fully featured integrated development environment (IDE) for R, and has many convenient capabilities when learning R. RStudio may be downloaded and installed for free from the site above.

All the examples and instructions in this book assume you have installed R are using RStudio. Be sure to turn off automatic environment saving in RStudio! Because this is so important, here it is again:

By default, RStudio preserves your R environment when you shut it down and restores it when you start it again. This is very bad practice!

The state of your R environment, which includes the values stored in variables, the R packages loaded, etc. from previously executed code is transient and may not reflect the results your code produces when run alone.

Open the Tools > Global Options… menu and:

  1. Uncheck “Restore .RData into workspace at startup”
  2. Set “Save workspace to .RData on exit:” to “Never”

Never save workspace

The book R for Data Science has an excellent chapter on why this is a problem and how to change the RStudio setting to avoid it.