This course is designed for researchers who want to write efficient R code. It focuses on practical skills for identifying computationally expensive functions and lines of code through profiling, applying best practices for writing performant code, and measuring improvements through benchmarking. You may already be working with large datasets, complex simulations, or have R scripts which take a while to run and you expect that it is possible that the code could be faster. Whether you want to speed up your code because you are frustrated with its slowness, care about the environmental impact of compute, or because you want to reduce the resources you require on HPC, this course will help you adopt coding practices that are more efficient and sustainable.
Difficulty rating: ★★★★ Advanced
Who is it for?
Both research staff and research students.
Summary of the topics covered
- Identify the most computationally expensive functions and lines of code in an R script using
profvis
- Measure the speed of code with
microbenchmark
- Evaluate R code to determine the limiting factors of its performance
- Recognise and implement optimisations for common limiting factors of performance
Prerequisites
Learners should have *at least six months of experience using R* and be comfortable with:
- Writing and running R scripts
- R data structures, such as vectors, matrices, lists and data frames
- Writing and using functions
- Installing and using R packages
- Familiarity with an IDE (the course will be taught in RStudio)
The Software Carpentry - R course - https://www.birmingham.ac.uk/research/arc/bear/training/software-carpentry-r - covers the expected material. Technical pre-requisites (e.g. packages to install in preparation) will be sent a few days in advance of the course.
Duration
6 hours
Next course
16 & 18 November 2026 13:00 - 16:00 (attend both sessions)
Book here
Can't attend?
We don’t have online materials for this session, but the course will run again — so you’ll be very welcome to join next time.