License change
The package has moved from 'Unlimited' licensing to GNU GPL 3. There are
a couple of reasons for the change. Originally assertive was a hobby
project, and the licence was designed so that I didn't have to worry about
it. Now that assertive has users other than myself, a proper license was
needed.
Secondly, a recent feature request was for a function to check whether RStudio
was up to date. Rather than reverse engineering this feature, I adapted some
code from the RStudio source (AGPL code), which meant that assertive now needed
to be AGPL compatible.Pretty printing
The most obvious thing is that the return values from is_
functions
now have a pretty printing method so that they now look similar to the error
message in the corresponding assert_
function. Compare, for example
is_na(1:12)
and assert_is_na(1:12)
. This object is still the
same as in previous versions, except that it has a class of
scalar_with_cause
or vector_with_cause
.
Try unclass(is_na(1:12))
to see this.
You now get to see the first 10 failures (up from 6) by default, and you can
force all failures to be shown using, for example,
print(is_nan(1:12), n_to_show = Inf)
.Multiple packages
Some users had noted that assertive was getting quite big, and package
developers didn't want to have such a large dependency. Consequently
I'm in the process of breaking assertive into smaller chunks. Currently the
base functionality is available in a new assertive.base
package.
Eventually, the rest of assertive will be broken down into other chunks;
with functionality for handling dates and time, personal data, etc.,
outsourced to their own packages.Support for pipes
assert_
functions now invisibly return their first input argument
(if there is one, and if no error is thrown, of course). This means that
fans of magrittr or pipeR pipes can now chain together multiple assertions.Better NA handling
Where an is_
function could return NA
, the corresponding
assert_
function gains an na_ignore
argument. This works like
the na.rm
argument in many stats package functions, except it doesn't
affect the position of the reported failure.Turning off assertions
Usually, the time for R to run an assertion is negligible compared to the
rest of your code. For some situations like simulations, where you call a
function millions of times, the assertion time can add up to something
undesirable. You can now include assertions in these functions for
debugging purposes, then set options(assertive.severity = "none")
to
turn off the checks, when you need your code to run fast.
Similarly, options(assertive.severity = "warning")
and
options(assertive.severity = "message")
allow you to include
assertions with a lower consequence for failures.Clearer error messages
Some error messages have been rewritten to make them clearer, in preparation
for...Translations
The infrastructure for errors and warnings in multiple langauges is in place,
and translations are planned for future versions. If you want to be a
translator, email me at richierocks@gmail.com.