A Installing R

A.1 Why should I install R on my computer?

The R StudioCloud cuts down on a lot of installation problems and it means that you have all the packages and functions you need already installed. However, it requires an internet connection to use.

Eventually to continue your R and Data Science journey you will probably want R and RStudio on your own computer.

There are some great detailed walkthrough videos by Danielle Narvarro on YouTube re: how to install R on both Windows and Mac.

A.2 Windows

If you are using Windows, you should download and install the following:

Once you've installed all three programs, restart your computer. Then, open RStudio (not R) and run the below code:

install.packages("tidyverse")

This will install the tidyverse package on your computer. If you have any problems installing R, please book into a GTA session as they should be able to help you with any installation problems.

A.3 Mac

If you are using a Mac, you should download and install the following:

If you have any issues installing R on your Mac, first, we recommend that you watch the walkthrough by Danielle Navarro.

If you have further issues on Mac, you may find this video helpful walkthrough video. Additionally, if you are using a Mac with the Catalina OS, we also recommend you read this troubleshooting guide

Once you've installed all three programs, restart your computer. Then, open RStudio (not R) and run the below code:

install.packages("tidyverse")

This will install the tidyverse package on your computer. If you have any problems installing R, please book into a GTA session as they should be able to help you with any installation problems.

A.4 Chromebooks

Please note that you cannot currently install R on a Chromebook, please use the R StudioCloud. ## RStudio Settings

There are a few settings you should fix immediately after updating RStudio. Go to Global Options... under the Tools menu (⌘,), and in the General tab, uncheck the box that says Restore .RData into workspace at startup. If you keep things around in your workspace, things will get messy, and unexpected things will happen. You should always start with a clear workspace. This also means that you never want to save your workspace when you exit, so set this to Never. The only thing you want to save are your scripts.

You may also want to change the appearance of your code. Different fonts and themes can sometimes help with visual difficulties or dyslexia.

RStudio General and Appearance settings

Figure A.1: RStudio General and Appearance settings

You may also want to change the settings in the Code tab. Foe example, Lisa prefers two spaces instead of tabs for my code and likes to be able to see the whitespace characters. But these are all a matter of personal preference.

RStudio Code settings

Figure A.2: RStudio Code settings

A.5 Using RStudio on your computer

Functionally there is no difference using RStudio on your own computer, just be mindful about where you are setting up your projects, and where files are located on your computer. My top tips:

Set up a folder for in your Documents folder for R projects. Within this folder make sure each unique analysis project has its own subfolder.

A.6 Installing LaTeX

You can install the LaTeX typesetting system to produce PDF reports from RStudio. Without this additional installation, you will be able to produce reports in HTML but not PDF. This course will not require you to make PDFs. To generate PDF reports, you will additionally need to install tinytex (Xie, 2021b) and run the following code:

tinytex::install_tinytex()