R version 4.5.2 (2025-10-31)
Platform: aarch64-apple-darwin20
Running under: macOS Tahoe 26.3
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.1
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: Europe/Berlin
tzcode source: internal
attached base packages:
[1] stats graphics grDevices datasets utils methods base
loaded via a namespace (and not attached):
[1] htmlwidgets_1.6.4 compiler_4.5.2 fastmap_1.2.0 cli_3.6.5
[5] htmltools_0.5.9 tools_4.5.2 otel_0.2.0 yaml_2.3.12
[9] rmarkdown_2.30 knitr_1.51 jsonlite_2.0.0 xfun_0.56
[13] digest_0.6.39 rlang_1.1.7 renv_1.1.7 evaluate_1.0.5
Coding and Teaching Library
Preface
This book serves as a library for my coding and teaching materials that I have developed over the years. The material is based on textbooks (references will be provided), websites (stackexchange, stackoverflow, …), and various online resources (e.g., blogs, books). Since AI tools have taken over coding, all my code is written and reviewed with the help of AI tools (see the transparency statement below).
The updated version of this library was written with the help of AI tools (ChatGPT 5, GitHub Copilot). All AI-generated text was carefully reviewed and edited by the author. Any errors or inaccuracies are the author’s own.
Leading Principles
Mainly caused through the replication/reproducibility crisis and my growing interest in reproducible coding practices, I try to follow two principles when writing code or teaching methods:
Computational Reproducibility: Most of the time, I strive to make all code and analyses reproducible. This means that anyone should be able to run the code and obtain the same results, regardless of their computing environment.
Transparency: Secondly, I try to be as transparent as possible about the methods and tools I use. This means providing clear documentation (and explanations) for the majority of code and analyses.
Software
Most of the provided code is from the statistical software R (R Core Team, 2025). You will also find some Quarto, yaml code snippets.
(Most Actively) Used Packages
The following (character) vector lists the R packages that I constantly use. The list may not be exhaustive, but it includes the most important ones.
pkg_list <- c(
# Reproducibility & Project Infrastructure
"here", # file paths
"renv", # dependency management
"pak", # package management
"knitr", # dynamic report engine
# Development
"devtools", # package development
# Data Handling
"haven", # SPSS/Stata import
"stringr", # string handling
# Statistical Modeling
"lme4", # linear mixed models
"lavaan", # SEM
# Report & Visualization
"DT", # interactive tables
"ggplot2" # graphics
)In the following you find the version of the packages which the book depends on. There complete list of all packages (including dependencies) that are used. The list is generated based on the renv lockfile.
Package Documentation
Code
The renv_lock_to_df() function of the helpmecode package processes the lockfile accordingly and returns a data frame with 3 columns: package, version, and source. The helpmecode package is an internal package that encompasses a variety of helper functions when working with R.
Credit to the Package Developers
Code
here (Müller, 2025), renv (Ushey & Wickham, 2026), pak (Csárdi & Hester, 2025), knitr (Xie, 2025), devtools (Wickham, Hester, et al., 2025), haven (Wickham, Miller, et al., 2025), stringr (Wickham, 2025), lme4 (Bates et al., 2025), lavaan (Rosseel et al., 2025), DT (Xie et al., 2025), ggplot2 (Wickham et al., 2026),
Package Installation
If you are interested in using the same packages as in this book, you can install them by running the following code snippets. To do this, I recommend using the pak package (Csárdi & Hester, 2025). The pak package is desinged to overcome some limitations of the install.packages() function and makes package management in R more reliable.
install.packages("pak", dependencies = TRUE)Once the pak package is installed, you can install the packages by running one of the following code snippets.
Code
pkgs_with_version <- c('DT@0.34.0', 'ggplot2@4.0.2',
'here@1.0.2', 'knitr@1.51', 'lavaan@0.6-21', 'lme4@1.1-38',
'pak@0.9.2', 'renv@1.1.7', 'stringr@1.6.0')
pak::pkg_install(pkg = pkgs_with_version, upgrade = FALSE)pak::pkg_install(pkg = pkg_list, upgrade = TRUE)License & Disclaimer
Unless noted otherwise, the content (text, figures, descriptions, etc.) of the website is licensed under CC BY 4.0.
Code is released under the MIT License.
Third-party components remain under their respective licenses. You are responsible for complying with those licenses.
No warranty is given regarding correctness, completeness, or availability.
Bugs & Errors
Found errors or any bugs? Please send me an email ✉ or report them directly to github.com. At every page, below the table of contents, there is link to the repository of the website. If you think your issue may important for others, please use this option.