R control flow loops and functions

Open to
Government analysts
Training category
Type of training
3 hours
Data Science Campus Faculty
Data Science Campus Faculty


Loops, control flow and the ability to write your own functions are valuable programming tools. Use of these tools help to reduce repetition in code; improving readability and following good coding practices. This short course covers and introduction to these topics and demonstrates areas for additional learning.

Learning outcomes

By the end of the session, participants will be able to:

  • understand the programming concept of Loops
  • utilise loops and understand their place in R
  • be able to use conditional statements: ‘if’, ‘else’, and ‘else if’
  • be familiar with ‘else_if()’ and ‘case_when()’ from dplyr
  • know what functions are and why they are useful
  • be able to distinguish between a function’s parameters and arguments including different types of arguments
  • understand the idea of ‘scope’, i.e. Global scope vs Local scope
  • be able to write and apply user defined functions
  • be able to apply functions to vector and tibble objects
  • introduction to R is a pre-requisite for this course

How to book

Please use your Learning Hub account to access this course online. If you do not have a learning hub account please contact Data.Science.Campus.Faculty@ons.gov.uk.


If you would like more information about this course, please email Data.Science.Campus.Faculty@ons.gov.uk. 

Related courses

Python control flow loops and functions