Duration: Instructor-led 4-days
Description:
This course is tailored for R users looking to level up their programming capabilities. You’ll explore advanced techniques in object-oriented programming (OOP), functional programming, efficient data handling, package development, parallel computing, and integration with APIs and production systems. Each module includes hands-on labs and real-world exercises using tidyverse, Rcpp, Shiny, and more.
By the end of this course, you’ll be equipped to write clean, maintainable, and efficient code suitable for production environments and large-scale data applications.
Prerequisites:
- Solid experience with base R and tidyverse
- Familiarity with basic data structures, control flow, and functions in R
- Prior exposure to ggplot2 and dplyr
- Basic knowledge of statistics or machine learning concepts (recommended)
Key Takeaways:
- Write modular, efficient, and reusable R code using functional and object-oriented paradigms
- Optimize R performance through vectorization, profiling, and C++ integration (Rcpp)
- Develop and document R packages and reproducible reports
- Leverage parallel and asynchronous computing for large-scale analysis
- Build and deploy interactive dashboards and APIs with Shiny and plumber
Module 1: Advanced Programming Concepts in R
Topics:
- Functional programming in R
- Closures and environments
- Lazy evaluation and promises
- S3 vs. S4 vs. R6: Object-oriented systems in R
- Debugging, tracing, and logging
Hands-on Labs:
- Build and test custom functions with closures
- Create your own S3 and R6 classes
- Implement decorators and wrappers
- Use trace(), debug(), and browser() for live debugging
Module 2: Performance Optimization and Rcpp
Topics:
- Vectorization vs. loops: when and why
- Memory profiling and benchmarking (profvis, microbenchmark)
- Writing high-performance code with Rcpp
- Compiling R code and bytecode evaluation
- Tidy evaluation with rlang for tidyverse programming
Hands-on Labs:
- Benchmark base R vs. vectorized solutions
- Profile and optimize real-world scripts
- Write and call C++ functions using Rcpp
- Use rlang::enquo() and !! in custom tidyverse-style functions
Module 3: Building Production-Ready R Code
Topics:
- Writing robust and tested R code
- Unit testing with testthat
- Package development from scratch (devtools, roxygen2, usethis)
- Continuous integration with GitHub Actions
- Reproducible workflows with targets or drake
Hands-on Labs:
- Create and publish a simple R package on GitHub
- Add unit tests and documentation
- Set up CI/CD pipelines
- Build a reproducible analysis pipeline
Module 4: Advanced Data Applications and Interoperability
Topics:
- Parallel computing with future, foreach, and doParallel
- Working with large datasets using data.table and arrow
- Building APIs with plumber
- Deploying dashboards with shiny, shinydashboard, and golem
- Interfacing R with Python via reticulate
Hands-on Labs:
- Run a parallelized simulation or ML pipeline
- Build a REST API that serves R model predictions
- Develop and deploy a Shiny dashboard
- Call Python functions from R and exchange data between the two