R for EHR: From Zero to Machine Learning
A free, hands-on course that teaches R and machine learning with health data, starting from zero.
Start with Chapter 01 Read the welcome page
For education only. All data in this course is synthetic (fabricated). Nothing here is clinical advice, and nothing here shows that any model is medically valid.
What you will be able to do
- Open RStudio, read a CSV and audit missing values.
- Use functions and make plots.
- Define the outcome and predictors, and split data by a valid unit.
- Impute without leakage, fit logistic regression and random forests, and cross-validate.
- Report performance and explain why a final holdout is not a reusable tuning set.
- Choose between regression, classification, clustering, PCA, association mining, anomaly detection, forecasting and survival methods.
Practice files
The lessons ask you to open an RStudio project and run scripts. Download the practice bundle: the project file, the synthetic dataset and the R scripts. It contains synthetic data only.
Download practice bundle (.zip)
Lessons
Start here
Part I — R foundations and data
- 01Orientation: What Are We Learning?hands-on8 min
- 02Set Up R and RStudiohands-on14 min
- 03Your First R Instructionshands-on32 min
- 04Vectors, Missing Values, and Conditionshands-on42 min
- 05Data Frames and CSV Fileshands-on39 min
- 06Clean, Filter, and Summarizehands-on32 min
- 07Visualize and Explore Datahands-on27 min
- 08Functions, Decisions, and Debugginghands-on30 min
Part II — Supervised learning: the complete workflow
- 09Define the Research Question and Labelhands-on13 min
- 10Statistics and Baselines for MLhands-on11 min
- 11Split the Data Before Modelinghands-on13 min
- 12Prepare Inputs Without Leakagehands-on18 min
- 13Regression: Predict a Numberhands-on11 min
- 14Classification: Predict a Categoryhands-on13 min
- 15Evaluate a Classifierhands-on14 min
- 16Cross-Validation, Tuning, and Thresholdshands-on13 min
- 17Decision Trees and Random Forestshands-on14 min
- 18Capstone: A Complete ML Projecthands-on17 min
Part III — Supervised learning: more methods
Part IV — Unsupervised learning
Part V — Other kinds of learning
Part VI — Choosing and comparing methods
Appendices
About this course
A revision of Jaewon Kim’s R Guide by the IHC/EHR Training Team. All examples use synthetic data and the course is for educational use only. See About.