Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
One of the bits of feedback that I got from the useR conference was that my assertive
package, for run-time testing of code, was too big. Since then I’ve been working to modularise it, and the results are now on CRAN.
Now, rather than one big package, there are fifteen assertive.*
packages for specific pieces of functionality. For example, assertive.numbers
contains functionality for checking numeric vectors, assertive.datetimes
contains functionality for checking dates and times, and assertive.properties
contains functionality for checking names, attributes, and lengths.
This finer grained approach means that if you want to develop a package with assertions, you can choose only the parts that you need, allowing for a much smaller footprint.
The pathological
package, which depends upon assertive
, gives you an example of how to do this.
The assertive
package itself now contains no functions of its own – it merely imports and re-exports the functions from the other 15 packages. This means that if you are working with assertive
interactively, you can still simply type library(assertive)
and have access to all the functionality.
Tagged: assertive, packages, pathological, r
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.