checkmate

Fast and Versatile Argument Checks

Tests and assertions to perform frequent argument checks. A
substantial part of the package was written in C to minimize any worries
about execution time overhead.

Fast and versatile argument checks for R.

Ever used an R function that produced a not-very-helpful error message,
just to discover after minutes of debugging that you simply passed a wrong argument?

Blaming the laziness of the package author for not doing such standard checks
(in a dynamically typed language such as R) is at least partially unfair, as R makes theses types of checks
cumbersome and annoying. Well, that's how it was in the past.

Enter checkmate.

Virtually every standard type of user error when passing arguments into function can be
caught with a simple, readable line which produces an informative error message in case.
A substantial part of the package was written in C to minimize any worries about execution time overhead.
Furthermore, the package provides over 30 expectations to extend the popular testthat package for unit tests.

Version 1.9.1

Version 1.9.0

Error messages now provide more information about error locations, e.g., the
position of the first missing element in a vector.

If the object to check is missing, assert-functions now give a better error
message, test-functions are always FALSE and expect-functions always
raise an exception.

Checks for missingness and sort order optimized for ALTREPs.

The calling frame reported in assertions is now identical to the calling
frame reported by R's stop() function (#117).

Added checkDouble to explicitly check for non-integer numerics.

Added checkRaw to check raw vectors.

Added checkFormula to check formula objects.

Added checkMultiClass to check for inheritance from a set of candidates

Added checkDisjunct to check sets for being disjunct.

Added abbreviation "p" to qassert to check for POSIXct objects.

Added argument coerce to assertCount/assert_count,
assertInt/assert_int and assertIntegerish/assert_integerish which
optionally coerces x to integer after an successful assertion.
This supersedes the functions asCount, asInt and asInteger (#77).

Added arguments max.rows and max.cols to check for maximum number
of rows and columns for matrices, data.frames, tibbles and data.tables.

Added functions makeAssertionFunction, makeTestFunction and
makeExpectationFunction to automatically create the respective functions
based on a provided check function.

Version 1.6.3

Assertions can now be collected (via makeAssertCollection()) and reported
(via reportAssertions()).

qassert() can now perform bound checks on strings.

The default for the parameter "ordered" of the *SetEqual functions is now
set to FALSE, as described in the documentation.

Version 1.6.2

Fixed a compile-time warning.

checkmate does not import testthat anymore in order to speed up package
loading times and to keep the dependencies at a minimum. The expect_*
family of functions can still be used, the namespace will be loaded on
demand.

Version 1.6.1

New family of functions: expect_* is intended to be used in combination
with testthat. But note that functions expect_null() and expect_named()
are not provided to avoid name clashes with testthat.

Added qexpect() and qexpectr().

Added argument all.missing for checks of matricies and data frames.

Added anyNaN().

Clarified documentation for assert() and allMissing().

Fixed a bug where bound checks were performed on missing values.

Fixed a bug where missingness was not correctly detected in data frames.

Version 1.6.0

Started to support long vectors.

Added a short vignette.

Improved documentation.

New argument "combine" for assert() to allow combining check functions with
an AND instead of an OR.

Version 1.5.3

Fixed a bug regarding the number of rows in zero-column data frames.

Fixed a bug where the type of lists with dimension attribute where reported
as "array" or "matrix".

Family *Array: new arguments "min.d" and "max.d".

Family *Array and *Matrix: Argument "mode" now additionally accepts strings
"list" and "atomic".