An R package for writing modular, reusable code using explicit imports and file-based modules without requiring full packages.
box is an R package that provides a module system and import mechanism for writing more modular, reusable, and maintainable R code. It allows developers to organize code into file-based modules that can be imported without creating full R packages, and replaces R's `library()` function with an explicit, scoped import syntax that prevents name clashes and global side effects.
R developers and data scientists working on larger projects or reusable codebases who need better code organization, explicit dependency management, and reduced namespace pollution.
Developers choose box because it brings modern software engineering practices to R, enabling explicit imports, local scope control, and easy code reuse without the overhead of creating full R packages, leading to more maintainable and less error-prone code.
Write reusable, composable and modular R code
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Allows creating reusable modules from regular R files with simple @export directives, eliminating the need for full package development, as shown in the 'Reusable code modules' section.
box::use() restricts imports to the current scope, preventing global namespace pollution and enabling safer function encapsulation, demonstrated with the log function example.
Import syntax mirrors Python, JavaScript, and Rust, easing adoption for developers from those backgrounds, as highlighted in the 'Loading code' section.
Supports nested modules within directories for complex project structures, facilitating scalable code organization without package overhead.
Cannot be installed directly from GitHub, requiring CRAN or R-universe, which may hinder access to latest developments, as noted in the 'Installation' section.
Replaces the ubiquitous `library()` function, demanding retraining and potential codebase migration, which can be disruptive in teams accustomed to traditional R practices.
Some R packages and tools may not be optimized for box's import system, leading to integration challenges, especially with packages relying on global side effects from `library()`.