Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

checkNull

Check if an argument is NULL


Description

Check if an argument is NULL

Usage

checkNull(x)

check_null(x)

assertNull(x, .var.name = vname(x), add = NULL)

assert_null(x, .var.name = vname(x), add = NULL)

testNull(x)

test_null(x)

Arguments

x

[any]
Object to check.

.var.name

[character(1)]
Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.

add

[AssertCollection]
Collection to store assertion messages. See AssertCollection.

Value

Depending on the function prefix: If the check is successful, the functions assertNull/assert_null return x invisibly, whereas checkNull/check_null and testNull/test_null return TRUE. If the check is not successful, assertNull/assert_null throws an error message, testNull/test_null returns FALSE, and checkNull returns a string with the error message. The function expect_null always returns an expectation.

See Also

Examples

testNull(NULL)
testNull(1)

checkmate

Fast and Versatile Argument Checks

v2.0.0
BSD_3_clause + file LICENSE
Authors
Michel Lang [cre, aut] (<https://orcid.org/0000-0001-9754-0393>), Bernd Bischl [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.