Chapter 12 Appendix
12.1 A. Package Reference
12.1.1 Core Tidyverse
| Package | Purpose | Used In |
|---|---|---|
dplyr |
Data manipulation | All chapters |
tidyr |
Data reshaping | Chapters 3, 5, 7 |
readr |
Fast I/O | All chapters |
purrr |
Functional programming | Chapters 6, 8 |
stringr |
String manipulation | Chapters 3, 5 |
lubridate |
Date/time handling | Chapters 4, 6, 7 |
ggplot2 |
Visualization | Chapters 3, 5, 8 |
12.1.2 Modeling
| Package | Purpose | Used In |
|---|---|---|
tidymodels |
ML framework | Chapters 3, 4 |
xgboost |
Gradient boosting | Chapters 3, 4, 6 |
prophet |
Time series | Chapter 4 |
modeltime |
Time series workflows | Chapter 4 |
cluster |
Clustering algorithms | Chapter 5 |
factoextra |
Cluster visualization | Chapter 5 |
DALEX |
Model explainability | Chapter 3 |
vip |
Variable importance | Chapter 3 |
solitude |
Isolation forests | Chapter 6 |
bayesAB |
Bayesian testing | Chapter 8 |
pwr |
Power analysis | Chapter 8 |
gsDesign |
Sequential testing | Chapter 8 |
12.1.3 Applications
| Package | Purpose | Used In |
|---|---|---|
shiny |
Web applications | Chapters 2, 4 |
shinydashboard |
Dashboard UI | Chapter 4 |
plotly |
Interactive charts | Chapters 4, 8 |
DT |
Interactive tables | Chapter 4 |
plumber |
REST APIs | Chapters 3, 6 |
blastula |
Email automation | Chapter 7 |
12.1.4 Infrastructure
| Package | Purpose | Used In |
|---|---|---|
targets |
Pipeline orchestration | Chapter 7 |
tarchetypes |
Pipeline helpers | Chapter 7 |
DBI |
Database connectivity | All chapters |
RPostgres |
PostgreSQL driver | All chapters |
dbplyr |
Lazy SQL evaluation | Chapters 3, 4 |
pool |
Connection pooling | Chapters 2, 3 |
bigrquery |
BigQuery interface | Chapters 3, 5 |
redis |
In-memory store | Chapter 6 |
logger |
Structured logging | All chapters |
renv |
Reproducible environments | Chapter 2 |
pins |
Artifact versioning | Chapter 11 |
12.3 C. SQL Translation Reference
Common dplyr to SQL translations:
| dplyr | SQL |
|---|---|
filter(x > 5) |
WHERE x > 5 |
select(a, b) |
SELECT a, b |
mutate(c = a + b) |
SELECT *, a + b AS c |
group_by(x) %>% summarise(y = mean(z)) |
SELECT x, AVG(z) AS y FROM ... GROUP BY x |
arrange(desc(x)) |
ORDER BY x DESC |
left_join(b, by = "id") |
LEFT JOIN b ON a.id = b.id |
head(10) |
LIMIT 10 |
12.4 D. Further Reading
12.4.1 Books
- R for Data Science (Wickham & Grolemund) — Foundation
- Tidy Modeling with R (Kuhn & Silge) — tidymodels deep dive
- Feature Engineering and Selection (Kuhn & Johnson) — Feature craft
- Designing Machine Learning Systems (Huyen) — MLOps architecture
12.4.2 Papers
- “A Unified Approach to Interpreting Model Predictions” (Lundberg & Lee, 2017) — SHAP
- “Planetary-Scale Prediction with XGBoost” (Chen & Guestrin, 2016)
- “Forecasting at Scale” (Taylor & Letham, 2017) — Prophet
12.5 E. Glossary
A/B Testing: Controlled experiment comparing two variants to determine which performs better.
Class Imbalance: When one class in a classification problem has significantly more observations than others.
Data Drift: Change in the statistical properties of input data over time, degrading model performance.
Feature Engineering: The process of transforming raw data into features that better represent the underlying problem.
Hyperparameter Tuning: The process of finding the optimal configuration for a machine learning algorithm.
Lazy Evaluation: Delaying computation until the result is actually needed, common in database operations.
MLOps: Practices for deploying and maintaining machine learning models in production.
Removal Effect: In Markov chain attribution, the decrease in conversions when a channel is removed.
SMOTE: Synthetic Minority Over-sampling Technique for addressing class imbalance.
Stratified Sampling: Sampling method that ensures subgroups are represented proportionally.
Time Series Cross-Validation: Cross-validation that respects temporal ordering to prevent data leakage.
Thank you for reading Production Data Science with R. Now go build something that lasts.