Tools for Robust R Packages
Building an R package is a great way of encapsulating code, documentation and data, in a single testable and easily distributable unit. At Mango we are building R packages regularly, and have been developing tools that ease this process and also ensure a high quality, maintainable software product. I will talk about some of them in this presentation. Our goodPractice package gives advice on good package building practices. It finds unsafe functions like sapply and sample; it calculates code complexity measures and draws function call graphs. It also incorporates existing packages for test coverage (covr) and source code linting (lintr). It can be used interactively, or in a continuous integration environment. The argufy package allows writing declarative argument checks and coercions for function arguments. The checking code is generated and included automatically. The progress package allows adding progress bars to loops and loop-like constructs (lapply, etc.) with minimal extra code and minimal runtime overhead. The pkgconfig package provides a configuration mechanism in which configuration settings from one package does not interfere with settings from another package.