R and RStudio installation instructions
There will be no time in lectures devoted to installing software!
Make sure you follow these directions closely, and make sure that you have successfully completed the "Testing your Install" section of this guide.
If you are having trouble, come and see me during office hours.
Software versions
Before the first lecture you should have the following software installed on your machine:
R 4.0.4
RStudio 1.4.1106
tidyverse 1.3.0
Installing for the first time
Follow these instructions if you have not previously installed R, Rstudio or tidyverse, or if you are unsure.
Installing R
Mac
Click "R-4.0.4.pkg"
When the file finishes downloading, double-click to install. You should be able to click "Next" to all dialogs to finish the installation.
Windows
Click "Download R 4.0.4 for Windows"
When the file finishes downloading, double-click to install. You should be able to click "Next" to all dialogs to finish the installation.
Installing RStudio
Go to https://rstudio.com/products/rstudio/download/#download
Select the installer appropriate for your operating system
RStudio-1.4.1106.dmg
for MacRStudio-1.4.1106.exe
for Windows
When the file finishes downloading, double-click to install. You should be able to click "Next" to all dialogs to finish the installation.
Installing tidyverse
Launch RStudio
In the bottom-left tab, labelled "Console", type
install.packages("tidyverse")
and hit enter.You will see various text appear in the console. Wait until you see a
>
symbol followed by a blinking cursor (this looks very dramatic, and may take up to a minute, so don't be surprised).
Updating installed software
If you have R and/or RStudio installed, you must still make sure that they are up to date so that you can you can run all of the necessary code.
In this class, we will be using R version 4.0.4 (Lost Library Book).
If in any doubt, follow the "Installing R" instructions. They will work even if you already have software installed.
Updating R
Open Rstudio.
If the first line of your console reads
R version 4.0.4 (2021-02-15) -- "Lost Library Book"
, then you have the correct version of R.If not, follow the instructions in this guide for "Installing R."
Once you have installed the latest version of R, open RStudio and select Tools > Global Options...
If the field "R Version" contains R version 4.0.4, you are finished. Otherwise, click the button "Change..." next to this field.
Click the Radio button "Choose a specific verion of R" and select R-4.0.4.
Click OK, and restart RStudio.
Updating RStudio
It is not essential to have the latest version of RStudio. However, if you would like to update, you should follows the instructions in this guide for "Installing RStudio".
Updating tidyverse
Open R or RStudio and run the command update.packages("tidyverse")
.
Testing your install
Once you have completed the above instructions, check that you have done everything correctly by following the following instructions:
Open RStudio. In the console, run the following commands by typing them into the console and hitting enter:
1 + 1
. You should see the output[1] 2
. If nothing happens or you are unable to type anything, redo the "Installing R" section of this guide.R.version.string
. You should see the output[1] "R version 3.6.3 (2020-02-29)"
. If you see a different version, refer to the "Updating R" section of this guide.library(tidyverse)
. You should see several lines of output in different colors. If you see the outputError in library(tidyverse) : there is no package called 'tidyverse'
, refer to the "Installing tidyverse" section of this guide.packageVersion("tidyverse")
. You should see the output[1] '1.3.0'
. If you see anything else, refer to the "Updating tidyverse" section of this guide.qplot(-5:5, (-5:5)^2, geom="line")
. You should see a parabola plotted in the bottom-right corner.
The full output should look like this (perhaps with a different coloured theme):
If all of the commands produced the expected results, you are ready for the first lecture!
If you were unable to get something working, please attend office hours - I will not answer questions about software installation during lectures!