R resources

Never done any coding before? Need to know how to download R and get started? These resources are for you.

On

What is R?

R is one of the most widely used software packages for doing statistics. If you'll be doing quite a bit of data analysis for your studies or in the future, taking the time to learn R is a good idea. However, you're not alone! We've complied some resources to help you. You may also be interested in attending our


First steps in R

R is a coding language. If you haven't done any coding before, don't let that put you off. These materials are designed to get you started from the very beginning.

1. Downloading R and R studio

A guide to downloading R and RStudio, the two pieces of software you will need for working in R.

Download written guide

2. Opening R and RStudio for the first time

Here we introduce the RStudio environment and begin to explore the ways in which we can interact with it.

Download written guide

3. Beginning to interact with R

How to enter your first instructions into the RStudio environment.

Download written guide

4. Objects and functions in R

Here we introduce the key ideas of objects and functions in the R environment. We look at how to define objects and call functions.

Download written guide

5. More about vectors

This video continues on from "Objects and Functions" Parts 1 and 2. There is continued discussion of vectors in R, how to define them and different categories of vector.

Download written guide

6. Matrices

The first video defines a matrix is and how to create one in R. The second defines character matrices and spotting errors in the definition of a matrix.

Download written guide

7. Creating Dataframes

Introducing dataframes in R. How to make a dataframe from scratch in RStudio.

Download written guide

8. Installing packages

What a package is and how to install a package to RStudio

Download written guide

9. Swirl

Swirl is a package designed for learning R interactively in RStudio. This video shows you how to install and begin using it.

Download written guide

10. Viewing built-in datasets

How to access and begin to manipulate the datasets in the "datasets" package which is installed by default with RStudio.

Download written guide

11. More objects

A guide to some more types of objects in the R environment.

Download written guide

12. Functions for getting to know a dataset

A quick tour of a few useful functions which help you to get a feel for a dataset in RStudio.

Download written guide

13. Importing data

Video 1: A quick guide to preparing and saving data using an excel spreadsheet before importing it into RStudio.

Video 2: How to get data into RStudio in the form of a data frame once the data have been prepared in an excel spreadsheet and saved in as a CSV file.

Download written guide


Where to go next

If you've mastered the ideas in the resources above but you'd like to go further with R there are various resources we'd recommend.

Help from MASH

MASH run workshops in R.

We also have bookable one-to-one appointments and drop in sessions. If you would like help getting going you can find more details .

Websites/Online Textbooks

鈥溾 is a clear, free online textbook

is an easily followable and well set out website with a good guide to R.

does what it says on the tin!

Swirl

Swirl is a package for learning R interactively within RStudio.

Begin by installing the 鈥渟wirl鈥 package by typing the following command into the console:

颈苍蝉迟补濒濒.辫补肠办补驳别蝉(鈥渟飞颈谤濒鈥)

Once the installation is complete, launch the swirl package by typing

濒颈产谤补谤测(鈥渟飞颈谤濒鈥)

From here swirl will automatically begin interacting with you.  Simply read the instructions on the screen and enter your responses.

Two people sitting at a table looking at some work together
Two people sitting at a table looking at some work together

Book a 1:1 appointment or workshop

Would you like to explore a maths or stats topic in greater depth? Why not book a 1:1 with an advisor or a workshop (current students only).