Accessing R

To use R on your computer, you need to download ‘R’ itself (you can think of this as the engine), as well as a program called RStudio which is an application that lets you use R. The steps to download both of these are below.

Alternatively, if you don’t want to install anything on your computer you can use RStudio Cloud, which is a limitted online version. If you choose this option, make an account on RStudio Cloud by following this link. The free version of RStudio Cloud only allows for 15 hours of time per month, but that will be plenty of time to complete this project.

To install the programs on your own computer, follow the instructions below. Alternatively, here is a video that goes through the process on Windows, and here is a video that goes through the process on a Mac.

Downloading R

To install the R language, go to this link and select the Download link that is correct for your operating system.

For Windows users, select the link called ‘base’, which is just the normal version of R. On the next page, click the big ‘Download R’ link at the top of the page (the link will also have the version number in the title), which will start your download. When the file has downloaded, open the ‘.exe’ file, and click through the installer prompts leaving all the default options.

For Mac users, find the heading that says ‘Latest release:’ and click on the link for the newest version of R, which will look like ‘R-x.y.z.pkg’, where ‘x.y.z’ is the version number. This will start your download. At this point, open the ‘.pkg’ file, and click through the installer prompts, leaving all of the default options.

You now have R installed on your computer! Lets move on to RStudio.

Downloading RStudio

RStudio is the program that lets you use R. It is free to download here. There are several versions of RStudio, but the one you want is RStudio Desktop. Scroll down after following the link, and select ‘Download’ below this option. The website will automatically suggest either the windows or mac version of RStudio, and go ahead and click ‘Download’ for the appropriate version for your machine. Once downloaded, run the ‘.exe’ file (for Windows) or the ‘.pgk’ file (for Mac). Click through the installer prompts, leaving all the default options. Once this is complete, you should be ready to go! (If you are on a mac, don’t forget to drag the RStudio icon into your applications folder when given the opportunity.)

Once downloaded, you can open RStudio the way you would any other application or program. When you first open the program, it should give you information about what version of R you are using.

Installing packages

For this project, you will need to have the package stringr installed in your environment. There are several ways to do this (try googling ‘install package R’) but the easiest thing to do is to click on the ‘packages’ tab in the bottom right window. From there, click on ‘Install’, and type ‘stringr’ into the packages box. Press ‘Install’ and RStudio will import your package for you (it may take ~10 seconds). Then search in the packages tab for ‘stringr’ and click the checkbox next to its name to ensure that it is loaded. See the screenshots below for help with this process:

Install a package: Go to ‘packages’ > ‘Install’

Install a package: Type ‘stringr’ into the packages field, and press Install

Load the package by checking the box next to ‘stringr’ after searching for it in the packages tab

Note that if you close RStudio and reopen it later, you may have to re-check this box. If you are getting error messages, this is one thing to check.

Definitions

While the goal of this project is to get you using R without going through an intense training process, it still is helpful to know several key definitions. Tutorialspoint.com breaks down R to the basics, and I recommend you read just a little bit about R here before you start (Not more than 10 or 15 minutes). For the purpose of this project, focus on the tabs called ‘Variables’, ‘Decision Making’, ‘Loops’, and ‘Functions’. If you don’t understand some, or even most of this, that’s ok! It may be helpful to have this page open in a browser tab while working through the exercises for you to reference as needed.