Information and course material for the Projects in R course of the Public Health Sciences Course Program at the University of Bern
- Course GitHub repository
- Course GitHub Page
Course participants will bring their own laptops with installed versions of R, RStudio, and Git:
- Download and install R:
- Windows: Click on "Download R for Windows", then click on "base", then click on the Download link.
- macOS: Click on "Download R for macOS", then under "Latest release:" click on R-X.X.X-arm64.pkg or R-X.X.X-x86_64.pkg for Apple silicon (M1/M2) or older Intel Macs, respectively.
- Linux: Click on "Download R for Linux" and choose your distribution for more information on installing R for your setup.
- Download and install RStudio.
- Install Git using the following instructions.
- If you don’t already have one, don't forget to create a GitHub account.
If you are new to R and RStudio, we recommend you to follow the 90-minute video tutorial Introduction to R and RStudio.
The following preparation steps are optional. You will also have time during the course to complete these steps.
- Make sure RStudio knows about Git by following the corresponding section here.
- Install the
usethis
package for R using the following command:install.packages("usethis")
- Set up Git using the following command:
usethis::use_git_config(user.name = "Jane Doe", user.email = "jane@example.org")
- Generate a personal access token (PAT) and store your PAT as described in Section 9.3 and 9.4 here.
To work on the exercises, course participants have to install the following packages:
usethis
- Workflow packagegitcreds
- Queries Git credentials from Rhere
- Easy file referencingtidyverse
- A set of packagesmedicaldata
- Medical data setscowplot
- Features to create publication-quality figures
Simply type install.packages("packagename")
, but RStudio will ask you about it as well if you want to load a package that you haven't installed yet.
Day | Time | Topic | Slides | Lecturer(s) |
---|---|---|---|---|
Monday, 22 April 2024 | 09:00-12:00 | Introduction to R, the tidyverse, and data wrangling | HTML | Christian Althaus, Alan Haynes |
Monday, 22 April 2024 | 13:00-17:00 | Data visualization with the tidyverse | HTML | Christian Althaus, Judith Bouman, Martin Wohlfender |
Tuesday, 23 April 2024 | 09:00-12:00 | Reproducibility and GitHub | HTML | Christian Althaus, Alan Haynes |
Tuesday, 23 April 2024 | 13:00-17:00 | Writing a reproducible report using Markdown/Quarto | Christian Althaus, Alan Haynes, Judith Bouman, Martin Wohlfender |
You can download all slides here. If you want to see them in your web browser, click the corresponding link in Timetable.
You can find material for the exercises here.
We will use the following data sets during the course:
File | Description | Source | Exercise |
---|---|---|---|
COVID19Cases_geoRegion.csv | Laboratory-confirmed SARS-CoV-2 cases by region | FOPH | - |
COVID19Cases_geoRegion_AKL10_w.csv | Laboratory-confirmed SARS-CoV-2 cases by region and age group | FOPH | - |
covid_cantons_2020_06.csv | Laboratory-confirmed SARS-CoV-2 cases for selected cantons and time period | FOPH | - |
ebola.csv | World-wide Ebola cases from 2014-2016 | data.world | 4 |
insurance_with_date.csv | Data on costs of medical procedures | kaggle | 5 |
We recommend the following online tutorials and books on R and RStudio with specific applications to epidemiology, public health, and data science:
- The R Manuals
- Hands-On Programming with R
- The Epidemiologist R Handbook
- Introduction to R for Public Health Researchers
- R for Data Science
- Fundamentals of Data Visualization
If you have any questions regarding the course, please get in touch with us at phs-info.ispm@unibe.ch or christian.althaus@unibe.ch.