Efficient R Programming

Efficient R Programming

Course Level: Advanced

This course is for anyone who wants to make their R code faster to type, faster to run and more scalable. During the course, we’ll cover the main R sins (and how to avoid them), dabble with hardware, look at running in parallel and think about efficient R data structure. This course should be useful to people with a range of skill levels.

Book: Efficient R Programming

Start Date:
Venue Details:

Course Details

  • Course Outline
  • Learning Outcomes
  • Materials
  • Prior Knowledge

Course Outline

  • Why is your code slow? Code profiling: which part of the code should you optimise.
  • Efficient data structures: Object growth and memory allocation.
  • Avoiding loops: Accessing the underlying C code faster.
  • Parallel computing: An introduction to multi-core computing.

Jumping Rivers staff quite literally wrote the book on Efficient R programming. Dr Colin Gillespie, a consultant at Jumping Rivers and Senior Statistics Lecturer in the School of Mathematics & Statistics at Newcastle University is the author of the recent O’Reilly book.

Learning Outcomes

Session 1:

By the end of session 1, participants will…

  • have an understanding of how computers use memory and test their RAM using {benchmarkme}.
  • know what benchmarks are and have the ability to use {bench} to identify which areas of R code needs optimising.
  • have a good understanding of how to efficiently manage memory within an R session.

Session 2:

By the end of session 2, participants will…

  • understand the common efficiency mistakes made within R scripts such as object growth and object creation.
  • understand why efficiency mistakes slows down code and how to apply faster alternatives.
  • have the ability to improve the efficiency of R code using the {parallel} package for parallel computing.
  • be able to avoid the key R sins of inefficiency, such as vector growth.

This course does not include:

  • Specific efficient R programming for collaboration, but following the key takeaways from the course would help.
  • Specific efficiency tips for the {tidyverse}, but the ability to test your own code is taught.


  • Page 1 of example course material for Efficient R Programming
  • Page 2 of example course material for Efficient R Programming
  • Page 3 of example course material for Efficient R Programming
  • Page 4 of example course material for Efficient R Programming
  • Page 5 of example course material for Efficient R Programming

Prior Knowledge

It will be assumed that participants are familiar with R. In particular, functions and for loops. Attending the programming with R course will be sufficient.

Attendee Feedback