3.1 What to Download

This section instructs new R users on how to download R Statistics and Rstudio. These are the two required applications for this book. Both are free to download and use! The current supported operating systems include Windows, Mac, and Linux. If you are using a Google Chromebook, there is an option to enable Linux: http://blog.sellorm.com/2018/12/20/installing-r-and-rstudio-on-a-chromebook/

3.1.1 R Statistics

In the upcoming pages, I will delve into vocabulary terms. For now, follow these instructions to download R Statistics and RStudio onto your computer.

Step 1: Select your CRAN mirror

To download R, you must use a CRAN (Comprehensive R Archive Network) mirror. For the sake of simplicity, I won’t talk about the intricacies of CRAN. All you need to do is select the link that closely matches your current location. https://cran.r-project.org/mirrors.html

Downloading R.

Figure 3.1: Downloading R.

Currently, I am located in Lincoln, Nebraska. It doesn’t really matter which CRAN mirror you select, but I selected one at the University of Kansas. The download will proceed faster if you choose a nearby location.

Selecting the CRAN mirror.

Figure 3.2: Selecting the CRAN mirror.

Step 2: Download R Statistics for your computer

Selecting your CRAN mirror should bring you to the “Download and Install R” page. Click on the link that matches the operating system (OS) you are currently using such as Linux, Macintosh, or Microsoft Windows. For Macs, you may also need to download an additional application (xQuartz); this will be specified to you on the download page.

3.1.2 RStudio

The R Statistics application installs the R language onto our computer and is required for RStudio to function; however we will not be using the R Statistics program for our R coding. Although we can technically code in R using the default R program, RStudio is preferred.

Compare Notepad (TextEdit for Mac users) to Microsoft Word. Although they both can perform the same basic task, Microsoft Word provides a host of tools (e.g., highlighting, font changes, insert columns/tables, references, headers, etc.) that are not available in Notepad. Similarly, RStudio is more user-friendly and more powerful than the default R program.

Download “RStudio Desktop”: https://www.rstudio.com/products/rstudio/download/

3.1.2.1 Orienting Yourself to RStudio

First thing’s first: Let’s make RStudio look cool.

To change the theme of RStudio, select Tools > Global Options > Appearance

I currently use “Pastel on Dark” as my editor theme, but the choice is yours:

Altering the RStudio theme.

Figure 3.3: Altering the RStudio theme.

Although most of your code will be in one color, RStudio will color code specific commands. This makes it easy for the user to navigate and recognize these commands and is especially useful for error checking. For example, you will notice that RStudio has selectively color coded comments. Comments are personal notes that the user can create by typing # before their text; R will not treat comments as executable code. We will get more practice with comments in the upcoming sections.

Next, let’s orient ourselves with how RStudio is set up. The standard set-up has four panes (the script pane will be discussed further soon). In all of my examples, my panes are arranged in this default format, but you can choose to rearrange the panes on your own.

A look at RStudio.

Figure 3.4: A look at RStudio.