Appendix A — Installing R
Installing R and RStudio is usually straightforward. The sections below explain how and there is a helpful YouTube video here.
A.1 Installing Base R
Install base R. Choose the download link for your operating system (Linux, Mac OS X, or Windows).
If you have a Mac, install the latest release from the newest R-x.x.x.pkg
link (or a legacy version if you have an older operating system). You may also need to install XQuartz to be able to use some visualisation packages.
If you are installing the Windows version, choose the “base” subdirectory and click on the download link at the top of the page.
If you are using Linux, choose your specific operating system and follow the installation instructions.
It can often cause problems to install R on a network or cloud drive, such as OneDrive or DropBox. It’s better to install these programs on your computer’s drive. Depending on your computer’s settings, you may have to get IT support to give you access to installing programs.
It can also cause rare, but hard-to-debug problems if any of the folders in the path where you install R have non-Latin characters, including Chinese characters or Latin characters with accents (e.g., C:\\Daniël\Programs\
).
A.2 Installing RStudio
Go to rstudio.com and download the RStudio Desktop (Open Source License) version for your operating system under the list titled Installers for Supported Platforms.
A.3 Installing RTools
If you are using Windows, after you install R, you should also install RTools; use the “recommended” version highlighted near the top of the list. RTools is used for installing and loading some packages. You can get started without installing RTools, but if you’re having problems with installing and loading some packages, this should be the first thing you try.
RTools will require you to put it “on the PATH”. The instructions for this can seem a bit vague - the easiest way to do it is to open RStudio, run the below code in the console:
Once you’ve done that, restart R by clicking Session - Restart R
and then run the below code in the console which should give you the path to your RTools installation:
A.4 RStudio Settings
There are a few settings you should fix immediately after updating RStudio. Go to
You may also want to change the appearance of your code. Different fonts and themes can sometimes help with visual difficulties or dyslexia.
You may also want to change the settings in the Code tab. For 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.
A.5 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. To generate PDF reports, you will additionally need to install