Last updated 2025-06-25.
This Github repo contains all lesson files for Machine Learning in R.
The goal is to impart students with the basic tools to construct,
evaluate and compare various machine learning models, using
tidymodels
. (Prior to 2025, this
course was based on the caret
package - this version can still be
found
here.)
These topics were taught in the graduate-level course Machine Learning for Psychologists (Psych Dep., Ben-Gurion University of the Negev; Psych Dep., Tel-Aviv University). (Materials developed with Yael Bar-Shachar.) This course assumes basic competence in R (importing, regression modeling, plotting, etc.), along the lines of Practical Applications in R for Psychologists.
Notes:
- This repo contains only materials relating to Practical Applications in R, and does not contain any theoretical or introductory materials.
- Please note that some code does not work on purpose, to force students to learn to debug.
You will need:
- A fresh installation of
R
(preferably version 4.3.2 or above). - RStudio IDE (optional, but recommended).
- The following packages, listed by lesson:
You can install all the packages used by running:
# in alphabetical order:
pkgs <- c(
"baguette", "BiocManager", "cluster", "DALEX", "DALEXtra",
"datasets", "dplyr", "factoextra", "finetune", "forcats", "ggplot2",
"ggrepel", "glmnet", "glue", "GPArotation", "insight", "ISLR",
"kernlab", "kknn", "leaps", "marginaleffects", "MASS", "modeldata",
"palmerpenguins", "parameters", "patchwork", "performance", "plsmod",
"probably", "psych", "psychTools", "randomForest", "recipes",
"rpart", "rpart.plot", "Rtsne", "scales", "stats", "tailor",
"themis", "tibble", "tidymodels", "tidyr", "tidyverse", "tune",
"vip", "xgboost"
)
install.packages(pkgs, dependencies = TRUE)
Package Versions
The package versions used here:
baguette
1.1.0 (CRAN)BiocManager
1.30.25 (CRAN)cluster
2.1.6 (CRAN)DALEX
2.4.3 (CRAN)DALEXtra
2.3.0 (CRAN)datasets
4.4.1 (Dev)dplyr
1.1.4 (CRAN)factoextra
1.0.7 (CRAN)finetune
1.2.0 (CRAN)forcats
1.0.0 (CRAN)ggplot2
3.5.1 (CRAN)ggrepel
0.9.6 (CRAN)glmnet
4.1-8 (CRAN)glue
1.8.0 (CRAN)GPArotation
2024.3-1 (CRAN)insight
1.3.0 (CRAN)ISLR
1.4 (CRAN)kernlab
0.9-33 (CRAN)kknn
1.3.1 (CRAN)leaps
3.2 (CRAN)marginaleffects
0.26.0.3 (Github: vincentarelbundock/marginaleffects)MASS
7.3-60.2 (CRAN)modeldata
1.4.0 (CRAN)palmerpenguins
0.1.1 (CRAN)parameters
0.26.0.1 (Dev)patchwork
1.3.0 (CRAN)performance
0.14.0 (CRAN)plsmod
1.0.0 (CRAN)probably
1.0.3 (CRAN)psych
2.4.12 (CRAN)psychTools
2.4.3 (CRAN)randomForest
4.7-1.2 (CRAN)recipes
1.1.0 (CRAN)rpart
4.1.23 (CRAN)rpart.plot
3.1.2 (CRAN)Rtsne
0.17 (CRAN)scales
1.3.0 (CRAN)stats
4.4.1 (Dev)tailor
0.0.0.9002 (Github: tidymodels/tailor)themis
1.0.3 (CRAN)tibble
3.2.1 (CRAN)tidymodels
1.2.0 (CRAN)tidyr
1.3.1 (CRAN)tidyverse
2.0.0 (CRAN)tune
1.2.1 (CRAN)vip
0.4.1 (CRAN)xgboost
1.7.8.1 (CRAN)