checkmate (version 1.7.2)

checkNull: Check if an argument is NULL

Description

Check if an argument is NULL

Usage

checkNull(x)

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

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

testNull(x)

test_null(x)

Arguments

x
[any] Object to check.
add
[AssertCollection] Collection to store assertions. See AssertCollection.
.var.name
[character(1)] Name for x. Defaults to a heuristic to determine the name using deparse and substitute.

Value

  • Depending on the function prefix: If the check is successful, the functions 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.

Examples

Run this code
testNull(NULL)
testNull(1)

Run the code above in your browser using DataLab