Practicals for the Data Train Course "Causal learning" 2025 (V Didelez)
If you use your own machine, ensure you have R v4.0.0 or higher.
Windows users, please make sure that rtools is installed on your computer! (https://cran.r-project.org/bin/windows/Rtools/)
Please use the R package pak to install the packages. It automatically
chooses the right platform like, e.g., CRAN, Bioconductor, also for
dependency packages.
# Install the following R packages within R/RStudio (please keep the order)
install.packages("pak")
library(pak)
# Install a package from github, which we will need in Part 3
pkg_install("github::ericstrobl/RCIT")
# if you need a github personal access token (PAT) in order to install the package
# scroll down - there is a how to.
To install the course R-package from github, simply type:
pkg_install("github::bips-hb/DataTrainCausalLearning")
# load the package.
library(DataTrainCausalLearning)
# install all other packages that are needed within the course
install_more()To open the practicals in your PDF reader, type
openPDF("Practical_part1_2025.pdf")
openPDF("Practical_part2_2025.pdf")
openPDF("Practical_part3_2025.pdf") To open the code, type
openCode("Causal2_code.html")- Go to [GitHub → Settings → Developer Settings → Personal Access Tokens → Tokens (classic)].
- Click "Generate new token".
- Give it a name (e.g.,
R Pak Token). - Select scopes:
- For most R packages:
repoandread:packagesare enough.
- For most R packages:
- Click Generate token.
- Copy the token immediately — you won’t see it again.
This works for the current R session:
Sys.setenv(GITHUB_PAT = "your_personal_access_token_here") install.packages("usethis") # if not already installed
usethis::edit_r_environ()- This opens the
.Renvironfile. - Add a line:
GITHUB_PAT=your_personal_access_token_here- Save the file and restart R.
- Now all GitHub installs will automatically use this PAT.
Restart R try again to install from github
library(pak)
pak::pkg_install("github::ericstrobl/RCIT")Download the ZIP-files and install it directly in RStudio over Tools → Install Packages ... → Install from Package Archive File → upload ZIP file
Download the files from here:
RCIT
DataTrainCausalLearning