June 18, 2026: Stop repeating yourself: functions and iteration in R
Sooner or later every R user hits the same wall: you need to do the same thing many times. Maybe you're running an analysis for each species, reading in every file in a folder, or fitting a model to each treatment group. The usual answer is copy-paste, which is slow and easy to get wrong.
In this hands-on workshop, you'll learn the two skills that solve this:
- Writing your own functions: wrapping repeated code into functions with arguments, defaults, and return values
- Iterating with the purrr package: using map() and friends to run a function over many inputs at once, replacing for-loops
We will work through practical examples together and you will learn how to take repetitive code of your own and refactor it into a function you apply across many inputs.
Format: 2-hour hands-on workshop. You'll follow along on your own computer.
Preparations:
Please set this up before the workshop:
- R and an IDE (RStudio or VS Code/Positron) installed and working.
- Basic R knowledge: you can read and write simple R code, work with vectors and data frames. You do not need to have written your own functions before.
- Packages: install tidyverse (which includes purrr) by running install.packages("tidyverse").
When? 18.06.2026, 4-6 pm
Where? Online on Webex
Meeting link:
https://fu-berlin.webex.com/fu-berlin-en/j.php?MTID=madef29c40301a6d7c771dd39a0571d0d
Meeting number:
2790 584 5750
Meeting password:
93WiT9s83BZ
Join from a video system or application
Dial 27905845750@fu-berlin.webex.com
You can also dial 62.109.219.4 and enter your meeting number.
Meeting password for video system
93948978
Join by phone
+49-619-6781-9736 Charged call
+49-89-95467578 Charged call
Access code: 27905845750
Global call-in numbers
https://fu-berlin.webex.com/fu-berlin/globalcallin.php?MTID=mcb74d1fde4590eee2a47a33aeb9e16b9
Meeting password for audio
93948978