Assertive programming doesn’t have to be ugly. If ultra-fast checks are
not your top priority, prettycheck
is for you. It provides a set of
functions that produce pretty and informative error messages, primarily
relying on the cli
package from
r-lib. Inspired by the
checkmate
package, it places a
strong emphasis on aesthetics and user experience.
prettycheck
also adheres to the tidyverse
principles and
integrates well with the tidyverse
ecosystem.
If you need a faster system for assertive programming, we recommend the
checkmate
package. Since
prettycheck
uses the same structure for checks, transitioning to
checkmate
is straightforward. You can also use both packages together
seamlessly.
You can install prettycheck
using the
remotes
package:
remotes::install_github("danielvartan/prettycheck")
Like checkmate
, prettycheck
includes four family of functions: test_*()
, check_*()
,
assert_*()
, and expect_*()
.
The test_*()
functions return a logical flag; the check_*()
functions throw a warning message as a string if the condition is not
met; and the assert_*()
and expect_*()
functions throw an error if
the condition is not met. If the condition is met, check_*()
returns a
logical flag; assert_*()
and expect_*()
functions return the input
object invisibly.
Here are some of the functions available for now:
test_identical()
check_identical()
assert_identical()
: Check if multiple objects are identical.test_length()
check_length()
assert_length()
: Check if an argument has a specific length.test_pick()
check_pick()
assert_pick()
: Check how many arguments were picked.
Click here to see the full list of functions.
We welcome contributions, including bug reports. Take a moment to review our Guidelines for Contributing.
prettycheck
code is released under the MIT
license.
Become an prettycheck
supporter!
Click here to make a
donation. Please indicate the prettycheck
package in your donation
message.