Assertive check functions for defensive R programming.
Introduction
goalie is an attempt to incorporate elements of multiple assertive check
packages into a single package with as few dependencies as possible. All
assertive checks are written in the most basic R code possible, without
reliance on compilation (e.g. C++/Rcpp). It is still a work in progress, and
feature requests are welcome.
R exports the stopifnot() function as a simple assert engine that supports
multiple boolean returns (TRUE/FALSE) in a single call, separated by commas.
This is a nice, flexible system for defensive programming. However,
stopifnot() does not currently support custom error messages, and can be
confusing to debug.
Similar to the approach used in the assertthat package, goalie exports the
assert() function, which is designed to be a drop-in replacement for
stopifnot() with improved error message support. validate() is a variation
on assert() that is intended to be used within S4 class validity checks, which
is useful for Bioconductor packages.
Additionally, goalie exports a number of assertive check functions that are
intended to harden bioinformatics-oriented functions in R. These check functions
return logical with an additional "goalie" S4 class definition, which
enables us to keep track of additional useful information about the cause of the
error (see cause() for details). This approach draws heavily from the
assertive package.
goalie
Assertive check functions for defensive R programming.
Introduction
goalie is an attempt to incorporate elements of multiple assertive check packages into a single package with as few dependencies as possible. All assertive checks are written in the most basic R code possible, without reliance on compilation (e.g. C++/Rcpp). It is still a work in progress, and feature requests are welcome.
R exports the
stopifnot()function as a simple assert engine that supports multiple boolean returns (TRUE/FALSE) in a single call, separated by commas. This is a nice, flexible system for defensive programming. However,stopifnot()does not currently support custom error messages, and can be confusing to debug.Similar to the approach used in the assertthat package, goalie exports the
assert()function, which is designed to be a drop-in replacement forstopifnot()with improved error message support.validate()is a variation onassert()that is intended to be used within S4 class validity checks, which is useful for Bioconductor packages.Additionally, goalie exports a number of assertive check functions that are intended to harden bioinformatics-oriented functions in R. These check functions return
logicalwith an additional"goalie"S4 class definition, which enables us to keep track of additional useful information about the cause of the error (seecause()for details). This approach draws heavily from the assertive package.Installation
This is an R package.
Conda method
Configure Conda to use the Bioconda channels.
See also
The goalie source code incorporates elements from these excellent assert check packages: