Box: Placing module system into R

Definitive Guide

Authors

Joshua Marie

John Riz Bagnol

Welcome!

Welcome to the definitive guide to module system in R using box!

Whether you want another way to import R packages, or simply seeking better ways to organize your code, this guide helps you to reimagine something did not exist in R for quite a long time: module system. This book introduces you the package that I discovered few years ago, it is called box, initially modules package, by Konrad Rudolph. This package provides a clean, straightforward API to define and manage modules. R, especially its users, suffers from managing huge R pipelines, because there’s no clean way to manage such complex pipelines…this problem will potentially cease to exists, as box package affords closely equivalent module system to other programming languages like Python, C#, and more.

What You’ll Find Here

A definitive guide that walks you through:

  • Alternative approach to import R codes (i.e. R packages, modules)
  • Modern approaches to compose and organize R codes
  • Step-by-step tutorials for using the box package
  • Best practices for maintainable R code

Why this book

Only little to no books teach you to correctly write reusable, composable, and modular R codes :). Most of the books maybe teaches you about R, particularly application of R in different fields, but little to none explains one of the best practices. Most of them uses library() anyways, so you won’t certainly find similar book like this.

Consequently, while R offers various ways to organize code, the box package manages to be superior among them (I am bias) by introducing a fresh, modern approach to module system that may significantly improve your R development workflow, similar to the workflow made by other developers, particularly Python devs. This book bridges the gap between basic R programming and professional-grade code organization.

How to Use This Guide

The content is structured progressively, building from foundational concepts to practical applications. For the best learning experience:

  1. Start with the introduction to understand the core concepts
  2. Follow the package management chapter to learn modern dependency handling
  3. Practice with the reusable modules chapter, including the importation of R data
  4. Review the conclusion to reinforce key takeaways