check_length: Check if Argument is of Proper Length

View source: R/cli.R

check_lengthR Documentation

Check if Argument is of Proper Length

Description

TODO.

Usage

check_length(x, arg_length = 1L, alt_null = FALSE, add_msg = NULL)

Arguments

x

Function arguments that are being asserted.

arg_length

Integer. Length of argument, for scalars it should take value 1 (default).

alt_null

Logical. Should argument accept NULL value.

add_msg

Is an additional message that can be printed over the standard function error message. You can:

  • pass the names of the arguments that failed the test by using {x_name} in the message body (e.g. "What are the {wrong_names}");

  • pass the tested length by using {arg_length} in the message body (e.g. "I want them to be {arg_length})"

  • pass the lengths of the arguments that failed the test by using {wrong_length} in the message body (e.g. "{wrong_lengths} are wrong")

Value

Returns invisible NULL when argument is of asserted length, otherwise it will throw an error.


cloudfs documentation built on May 29, 2024, 11:08 a.m.