Course Information

Author

Government Analysis Function and ONS Data Science Campus

Data Science Campus and Analysis Function logos.

To switch between light and dark modes, use the toggle in the top left

1 Introduction

This course will cover basic concepts and give you the confidence to work independently in the R programming language. No prior coding or statistical knowledge is assumed, however you should be confident using basic computer software.

The course is split into chapters; each chapter will build upon the previous one. It will emphasise the application of skills, building confidence and resilience in programming.

It is essential that you have frequent opportunities to practice what you have learnt from the course.

2 Course Materials

The course materials come in several formats:

  • HTML pages such as the one you are reading now

  • Data we will use during the course. It’s highly recommended you create a project with a ‘data’ folder and download all the required datasets before starting the course

You can also navigate to the course Github Repository and clone or fork the website structure for yourself. If you are new to programming and version control, we recommend you remain on the website to gain the best experience.

3 Software Requirements

  • R programming language
  • R studio (recommended but not essential)
  • Web browser (Internet connection not necessary)
  • Excel or other spreadsheet software for viewing csv and xlsx documents

4 Packages

Packages are the fundamental units of reproducible R code. They include reusable R functions, the documentation that describes how to use them, and sample data. The following will be used in this course:

  • tidyverse
  • readxl
  • janitor

5 Pre-Course Check-list:

  • Install R and RStudio on your laptop as per your department’s guidance.

  • Check your department’s guidelines for installing packages.

  • Save the data from the ZIP file to your hard drive in your working directory.

6 Course Overview

The course is divided into 6 chapters, over the 2 days we will cover,

  1. Chapter One - Getting Started with R

    • Be familiar with R Studio.

    • RStudio environment, layout, and customization.

    • Understand the Key Benefits of using R.

    • How to run code in R.

    • Know where to get help.

    • Discover R’s data types.

    • Be able to create Variables.


  1. Chapter Two - Data Structures

    • Be familiar with data structures in R.

    • Understand how vectors operate.

    • Be familiar with lists.

    • Be familiar with data frames and tibbles.


  1. Chapter Three - Importing and Exporting Data

    • Organise our work

    • Have an understanding of what packages are.

    • Be able to load and install a package.

    • Be able to check package versions and R version.

    • Be able to import data from multiple formats.

    • Be able to inspect loaded data and select elements within the data frame.

    • Be able to export data.

    • Be able to explore data.


  1. Chapter Four - Tibbles and Dplyr
  • Understand the importance of clean variable names.

  • Be able to clean column names using the janitor package.

  • Understand the use of the pipe operator.

  • Be able to sort data with dplyr’s arrange verb.

  • Be able to select data with dplyr’s select verb.

  • Be able to filter data with dplyr’s filter verb.

  • Be able to transform data with dplyr’s mutate verb.

  • Be able to join datasets together.


  1. Chapter Five - Summary Statistics and Aggregation

    • Describe numeric and categorical data

    • Aggregate and data

  2. Chapter Six - Case Study