nl en

Statistical computing with R


Admission requirements

Students are assumed to be following (or have previously followed) the courses "Statistics & Probability", "Mathematics for Statisticians" and "Generalized Linear Models and Linear Algebra" from the MSc in Statistics and Data Science.


Since its inception in 2000, R has grown to be one of the most versatile and widely used programming languages for statistics and data science. In Statistical Computing with R you will be introduced to programming, data analysis and statistical computing with R.
In the first half of the course we will cover the basics of R, including object types, functions, conditional statements, different types of loops, R scripts, R Markdown, R packages and documentation, and data visualization with base R.
In the second part of the course we will explore more advanced topics, such as warning and error messages, data visualization with ggplot2, functions for probability theory, numeric optimization and maximum likelihood estimation, strategies to make R code faster and more efficient, data handling methods, the dplyr package, and mixture models and the EM algorithm.

Course objectives

By the end of the course, students should be able to use R and RStudio to:
1. import and manipulate data;
2. perform basic statistical analyses;
3. produce data visualizations;
4. write and debug simple R programs and functions;
5. solve estimation problems that require numeric optimization;
6. write neat and annotated code;
7. generate reproducible reports (R Markdown).


You will find the timetables for all courses and degree programmes of Leiden University in the tool MyTimetable (login). Any teaching activities that you have sucessfully registered for in MyStudyMap will automatically be displayed in MyTimeTable. Any timetables that you add manually, will be saved and automatically displayed the next time you sign in.

MyTimetable allows you to integrate your timetable with your calendar apps such as Outlook, Google Calendar, Apple Calendar and other calendar apps on your smartphone. Any timetable changes will be automatically synced with your calendar. If you wish, you can also receive an email notification of the change. You can turn notifications on in ‘Settings’ (after login).

For more information, watch the video or go the the 'help-page' in MyTimetable. Please note: Joint Degree students Leiden/Delft have to merge their two different timetables into one. This video explains how to do this.

Mode of Instruction

A combination of lectures and computer practicals. To fully benefit from the practicals, it is recommended that you bring your own laptop with R and RStudio installed.

Assessment method

The final grade will be determined as a weighted average of the homeworks assigned during the course (15%) and the final (retake) exam (85%). To pass the course, both the grade of the (retake) exam and the final grade should be at least 5.5.
The homework counts as a practical, and there is no retake for it.

Reading list

  • Braun, W. J., & Murdoch, D. J. (2021). A First Course in Statistical Programming with R. Cambridge University Press.

  • Rizzo, M. L. (2019). Statistical Computing with R. CRC Press.


From the academic year 2022-2023 on every student has to register for courses with the new enrollment tool MyStudyMap. There are two registration periods per year: registration for the fall semester opens in July and registration for the spring semester opens in December. Please see this page for more information.

Please note that it is compulsory to both preregister and confirm your participation for every exam and retake. Not being registered for a course means that you are not allowed to participate in the final exam of the course. Confirming your exam participation is possible until ten days before the exam.

Extensive FAQ's on MyStudymap can be found here.