3 Internal Coding Courses

MoJ analysts are recommended to take the internal training courses as they are run using the MoJ Analytical Platform and focus on topics of relevance to MoJ analytical work.

The main introductory R, SQL and Git/GitHub sessions are usually run live in February/March, June/July and October/November each year while you can also work through R, SQL, Git/GitHub and Python sessions yourself using the training material and/or recordings.

There’s also an Introduction to the Analytical Platform - see the Analytical Platform chapter for more information.

3.1 R Training

The following courses are available; click on the links to view the latest recordings and GitHub repositories (which to view you’ll need to have a GitHub account - see the Analytical Platform User Guidance section on creating a GitHub account to set one up) respectively. The first three are particularly recommended for new starters.

3.1.1 Introduction to using R on the Analytical Platform

Link to recording, Link to GitHub repository

This course is for people who are new to the Analytical Platform (AP). It will introduce the key tools needed including the AP control panel, GitHub, RStudio, SQL, repositories, Amazon S3 buckets and packages. No coding experience is needed.

It will also work through the steps needed to get you set up for the Introduction to R course. You will log onto the AP and RStudio, clone the ‘Intro to R’ repository, and get access to the dataset needed for ‘Intro to R’ from an Amazon S3 bucket.

3.1.2 Introduction to R

Link to recording of part 1, Link to recording of part 2 and Link to GitHub repository

This course aims to get new users up and running using R on the Analytical Platform with confidence. It includes topics such as introducing R Studio, installing packages, importing datasets, dealing with missing values, duplicates and dates, recoding values, producing subsets, merging datasets, producing summary statistics, and how to ask for help. It excludes charting as there is a separate session for this (see below).

3.1.3 R Charting

Link to recording, Link to GitHub repository

One of the best attributes of R is its charting capabilities. This session complements the Introduction to R course and is for those who are new to R charting using the R package ggplot2.

3.1.4 Introduction to R +

Link to recording, Link to GitHub repository

This course builds on the Introduction to R course introducing some additional techniques for working with data in R. The first two parts cover two fundamentals of programming in R: conditional statements and loops. Together these concepts massively increase the scope of what can be achieved by writing code. The later chapters cover other useful techniques for manipulating data, managing missing data, reshaping data, and working with strings. There’ll be plenty of examples and some exercises to help you get acquainted with incorporating these techniques into your own code.

3.1.5 R Markdown

Link to recording and Link to GitHub repository

This introductory course will focus on how to use R Markdown to automate the production of text in statistical publications (the process for other analytical reports will be similar).

3.1.6 Interfacing Excel with R

Link to recording and Link to GitHub repository

This course teaches learners to: read in data from an xlsx format for manipulation in R; write output data tables/results into a multi-sheet xlsx format; style outputs consistently and reproducibly in excel tables; know how to use an excel template to add iterative data/results. This does not cover how to replicate common excel functionality in R (please see Introduction to R, Introduction to R+ and Writing Functions in R courses for this), nor does it cover working with S3 on the Analytical Platform (please see the introduction to using R on the Analytical Platform and Introduction to R courses for this).

3.1.7 Writing Functions in R

Link to recording and Link to GitHub repository

By the end of the course, you should know how to write a basic function, the circumstances when you might want to consider writing a function, why using functions is beneficial, the best practice for writing functions, and where to go for more information on some of the topics covered in this course.

3.1.8 Developing R packages

Link to recording of part 1, Link to recording of part 2 and Link to GitHub repository

This course will take you through the steps to make, develop and maintain an R package. Packages are not difficult to make, enable others to easily use your code and are an important part of reproducible ways of working.

3.1.9 Coding testing in R

Link to recording and Link to GitHub repository

Vital for reproducible ways of working and important for AQA, this introductory course includes why, when and what code (within an R package) to test using the R package testthat. While there is a short Developing R packages course section on code testing, this session provides much greater depth and enables you to practice writing your own tests.

3.1.10 Video library

You can view the above courses and other less recent recordings (for instance of the old Developing R packages and RAP ways of working: Link to recording of part 1 and Link to recording of part 2) in the R/SQL/Git Training Video Library.

3.2 Git/GitHub Training

Whether seeking to use R, SQL or Python, it is recommended that all newcomers attend or work through themselves the Introduction to Git/GitHub which provides you with an understanding of what Git/GitHub is and explains the key benefits of using it alongside the Analytical Platform and R Studio. Step-by-step instructions will be provided about how to use GitHub in R Studio, allowing you to feel confident in using the software in your day-to-day work. These include how to store code appropriately, track changes, collaborate with others and provide clear documentation. Even if you are coding a one-off product, we highly recommend you use GitHub.

Link to GitHub repository (which to view you’ll need to have a GitHub account - see the Analytical Platform User Guidance section on creating a GitHub account to set one up) and most recent Link to recording. You may also want to watch the Intro to Git/GitHub - Merge conflict resolution: see Link to recording. You can view this and other less recent recordings in the R/SQL/Git Training Video Library.

3.3 SQL Training

New SQL users should attend or independently complete the Introduction to SQL using Athena course and if using RStudio the Using SQL in RStudio on the Analytical Platform course; click on the links to view the latest recordings and GitHub repositories (which to view you’ll need to have a GitHub account - see the Analytical Platform User Guidance section on creating a GitHub account to set one up) respectively.

3.3.1 Introduction to SQL using Athena

Link to recording of part 1, Link to recording of part 2 and Link to GitHub repository

This course aims to help new users get up and running with SQL (using Athena) on the Analytical Platform with confidence. It will demonstrate how to run SQL queries using Athena on the Analytical Platform and will cover the key functions needed for data and analytical work. Topics include why you might want to use SQL, the basic structure of SQL commands, database manipulation (such as filtering and aggregating data) and SQL joins. The course includes practical exercises to give you hands-on experience of writing SQL queries.

3.3.2 Using SQL in RStudio on the Analytical Platform

Link to recording and Link to GitHub repository

The course aims to help new users get set up and confidently run SQL code in RStudio on the Analytical Platform. It will demonstrate how to install and use dbtools and Rdbtools packages which enable running SQL code in RStudio on the Analytical Platform. The course will also focus on practical use cases, such as querying databases stored in Athena using these R packages and producing simple visualisations. Please note that this course will not cover SQL commands and concepts. This content is covered in the “Introduction to SQL using Athena” training course, which is an essential pre-requisite.

3.3.3 Video library

You can view the above and other less recent recordings in the R/SQL/Git Training Video Library.

3.4 Python Training

These have not yet been run as live sessions, but you can work through the material at your own pace.

3.5 Get involved!

One great way of learning is by teaching. If you would be interested in playing an active role, whether delivering, updating or designing training, or co-ordinating the courses, please contact Aidan Mews or Phillip Buckham-Bonnett (R or Git/GitHub), Georgina Eaton or Craig Medhurst (SQL), or Mike Ratford (Python).

If you have any questions please contact Aidan Mews, Georgina Eaton, Craig Medhurst or Mike Ratford.