Programming in R
Date:
07/10/2025 - 10/10/2025
Organised by:
Royal Statistical Society
Presenter:
Jumping Rivers Tutor
Level:
Intermediate (some prior knowledge)
Contact:
Venue: Online
Description:
Level: Intermediate (I)
The intensive course on programming principles in R. This course covers the fundamental techniques such as functions, for loops and conditional expressions. It also covers the {tidyverse} package, {purrr}. {purrr} is a very powerful package that gives great flexibility to analysts, by enhancing R’s functional programming toolkit.
By the end of this course, you will understand what these techniques are and when to use them. The course will also demonstrate how to use functions such as map(), map2() and pmap(), to iteratively map functions over multi-element objects like vectors and lists. Emphasis will also be placed on how to manipulate list outputs and how this can be applied to data..
Learning Outcomes
By the end of the course, delegates will:
- Understand basic functions, multiple arguments and variable scopes.
- Have a thorough understanding for loops.
- Be able to apply basic functions.
- Have a thorough understanding of conditionals such as if, else and else if statements.
- Be familiar with possible R workflows such as directory structure and working with directories.
- Understand how the aforementioned techniques can be applied to their own data.
- Understand how these techniques will improve efficiency and results.
- Understand where to find help in R using resources and the help() function.
- Understand lists in R and know how to use {purrr} to map functions.
- Know what nested loops are and use {magrittr} to extract elements from them.
- Be able to create list columns and know how to access the data in them.
- Iteratively loop two or more objects to a function of choice using functions such as map2(), pmap() and imap().
- Recognize the advantages of using {purrr}.
- Understand how to extract elements from nested lists to achieve a desired output object class.
- Be able to effectively debug their code using multiple {purrr} functions for the debugging process.
- Save precious debugging time using e.g. safely()
Topics Covered
- Conditionals: using if and else statements in R
- Functions: what a function is, how are they used, and how can we construct our own functions.
- Looping in R: an introduction to the concept of looping in R. In particular for and while loops.
- Help: The help system in R can at first glance appear daunting, however, after the initial shock, R’s documentation is second to none.
- Project structure: Practical tips on how to structure a project.Data manipulation and aggregation using dplyr
- Introduction to {purrr} and Lists: Introduction to lists in R and using {purrr} to map a function across a list.
- List-Columns and Nesting: Exploring nested data in list columns and using the mapping functions to manipulate them.
- Parallel Mapping: Using {purrr} functions to map over multiple lists in parallel.
- Manipulating {purrr} Output: Using {purrr} to efficiently extract elements from lists into vector and dataframe format, and change the hierarchy within nested lists.
- Best Practices in {purrr}: Showcase of functions from {purrr} which aid in the debugging process.
Target Audience
This course is idea for anyone who would like to extend their basic familiarity with using R, and using R to write their own bespoke functions or optimizing their code.
Assumed Knowledge
Basic prior experience with the R programming language is assumed. Namely that participants have some experience of R data structures, such as vectors, data frames, and experience in using pre-made functions from R packages.
The course is aimed as a follow up the 'Introduction to R and Regression Modelling in R' training course.
Whilst no statistical knowledge will be assumed, some of the examples will be statistical in nature.
For this online course, participants are not required to have R installed on their own laptops. A virtual environment, which can be accessed through a web browser, will be used to run R and view course materials.
Cost:
Prices from £668.40 to £926.40 (inc. VAT)
Website and registration:
Region:
Greater London
Keywords:
Quantitative Data Handling and Data Analysis, R, tidyverse, purrr,
Related publications and presentations from our eprints archive:
Quantitative Data Handling and Data Analysis
R