Installing R/RStudio on Windows

Dec 10, 2019 R Windows

Before you install R Stuff.

Follow the instructions in my post called Configure a Windows PC for Data Science before you install any R stuff.

What are R, R Studio Desktop and R packages

R, R Studio Desktop and R packages are software programs made and supported by many different people. You can learn more about R, and the people that currently curate it, on Wikipedia. R Studio Desktop is an “Integrated Development Environment”, which makes it possible to use point and click tools to see your work, made by a company called R Studio. While there are some companies that add to R for a fee, most R packages are made by random individuals scattered across the globe who just like to solve problems.

Think of R as the engine that powers your analysis. R Studio Desktop is the rest of the car that you get from the dealer. R packages are the after sales bling that you add on to make your car special.

First install R

You can get the latest release of R from here. On December 10, 2019 the latest release was R-3.6.1-win.exe. R updates several times a year. “Patch” updates will cause the x.x.1 to change to another number. “Minor” updates, which change the x.6.x to a new number, happen in April of every year. Major updates to R are rare (Version 2.0.0 came out in 2004, 3.0.0 was in 2013) but the next (not patch) update to R will be 4.0.0.

Next Install R Studio Desktop

R Studio Desktop can be downloaded from here. After you install it, you will want to make a couple changes to your configuration.

General Options

Choose Global Options… from the RStudio Tools menu.

Image of Global Options menu item

Figure 1: Image of Global Options menu item

Once you are there, in the Workspace section, uncheck the Restore .RData into workspace at startup checkbox and set the Save workspace to .RData on exit to be Never

Image of Workspace options in the General windowpane

Figure 2: Image of Workspace options in the General windowpane

Code Options

Next click on the Code windowpane and then click the Display tab from the tabgroup at the top of the screen. Check on the box to Show margin and make sure the Margin column is set at 80 characters.

Image of the Code options windowpane after clicking the Display

Figure 3: Image of the Code options windowpane after clicking the Display

Later, when you write code, this option will put a thin gray line on the right margin of the screen. It will help to remind you to keep your lines of code short enough to read. I will say more about that later.

Install Rtools

Many, if not most, R packages come ready to used, but a few need to be “built” on your machine. You will most likely run into this when you ask R to update your packages and it asks you if you want to build the latest version (… more about that later). You can download the tools for building packages from here. Grab the “recommended” version, which is highlighted in green. If the installer asks you if it can update paths, say yes.

These “Rtools” will be used when you want to package up your own work to share with the world. Once you have completed this step you are all set. You can now get premade packages and/or build R packages.