We will be using some example data in the lesson. Download the file from here and extract it to your computer
This lesson assumes you have the R and Rstudio software installed on your computer. This should already be the case if you are using the University computers on a cluster.
R can be downloaded here. Select the precompiled binary distribution for your operating system.
Rstudio is an environment for code development using R. It can be downloaded here. You will need the Desktop version for your computer; scroll to the bottom of the page for links.
To install R and RStudio on a University managed windows machine, connect your computer to the university network and open the Software Centre from the Start Menu, then search for and install Rstudio. This will also automatically install R for Windows 4.3.1 and Rtools. R packages are installed onto your P drive, therefore make sure your P drive can be opened and has free space available.
If this is you, we recommend that you either:
Log on to a University of Manchester Cluster PC. RStudio is available in most computer clusters including the Main Library, AGLC, Stopford and AMBS.
Sign up and create an account on R Studio Cloud (a cloud based version of RStudio) which will allow you to use Rstudio in any web browser without requiring any installation. The free account provides about 15 hours of computing time per month. This service is not associated with the University of Manchester. You should take care to ensure that you only sign up for a free account. To upload your dataset, use the Upload button at the Files tab on the bottom right window.
The course teaches the tidyverse, which is a collection of R packages that are designed to make many common data analysis tasks easier. Cluster computers already have the tidyverse installed. If you are using your own laptop please install this before the course. You can do this by starting Rstudio, and typing:
install.packages("tidyverse")
At the >
prompt in the left hand window of RStudio. You may be prompted to select a mirror to use; either select one in the UK, or the “cloud” option at the start of the list.
R will download the packages that constitute the tidyverse, and then install them. This can take some time. You may get a prompt There are binary versions available but the source versions are later
and asking if you want to install from sources packages which require compilation. You should answer no to this.
If you are using a mac you may be prompted whether you wish to install binary or source versions of the packages; you should select binary.
On Linux, several of the packages will be compiled from source. This can take several minutes. You may find that you need to install additional development libraries to allow this to happen.
There will be a number of messages displayed during installation. After the installation has completed you should see a message containing:
** testing if installed package can be loaded
* DONE (tidyverse)
Type the following commands at the >
prompt:
library(tidyverse)
ggplot(cars, aes(x=speed, y=dist)) + geom_point()
(the message about conflicts can be safely ignored)
This should produce a plot in the lower right hand window of RStudio.
If you encounter difficulties installing R, RStudio or the Tidyverse please contact martin.herreriasazcue@manchester.ac.uk before the course starts. There is little time to resolve installation problems on the day.