RStudio

RStudio is the most popular IDE (integrated development environment) for R. That basically means most people write and debug their R code inside this text editor. It’s also the editor the instructor and TAs will be using for demonstration. But you are free to use whatever editor you that makes you most productive. For experienced programmers Visual Studio Code might be a good alternative with the R extension.

Technically the editor’s name is RStudio Desktop, though people are used to call it RStudio, the name of the company behind it. In August 2022, the RStudio company announced that it will be renamed to Posit.

Installation

Install the latest version of RStudio Desktop at https://www.rstudio.com/products/rstudio/download/. Just click the “Download RStudio” button and follow the simple instructions that follow. There are no platform-dependent steps for installing RStudio.

Once you’ve installed RStudio, you can open it like any other program on your computer usually by clicking an icon on your desktop.

Note

Even if you use RStudio, you’ll still need to download R to your computer. RStudio automatically detects and uses the version of R that lives on your computer, but it doesn’t come with a version of R on its own.

If everything goes well, you should see the following screen when opening RStudio.

RStudio

Configuration

RStudio allows customization through global settings. Here I list some of my personal preferences for configuring RStudio, it is not required that you do the same.

Manage history

If you want every R session to be completed isolated from each other and no history being saved (which is a actually a good idea when it comes to coding, you should be saving the script anyway).

Open the optionsmenu from the menu bar via Tools -> Global Options. In General -> Basic

  • uncheck Restore .RData into workspace at startup

  • set Save workspace to .RData on exit to Never

  • uncheck Always save history (even when not saving .Rdata)

Do not save history

Pane layout

Many times I with the my course code and R console to be displayed side by side, not on top of the other. You can set this in Pane Layout in the options menu.

Text encoding

Set default text encoding to “UTF-8”

Set default text encoding

Set pane layout

Customzed pane layout