abort_argument: Abort based on issues with function argument

Description Usage Arguments Value See Also

Description

Create a custom error condition created with rlang::abort() with a - hopefully - more useful error message and metadata.

Usage

1
2
3
4
5
6
7
8
9
abort_argument_type(arg, must, not)

abort_argument_class(arg, must, not)

abort_argument_length(arg, must, not)

abort_argument_diff_length(arg1, arg2)

abort_argument_value(arg, valid_values)

Arguments

arg

A character string with the argument name.

must

A character string specifying a condition the argument must fulfill.

not

Either a character string specifying a condition the argument must not fulfill or the bare (unquoted) argument name. In the last case, the function evaluates the argument type (abort_argument_type()) or length (abort_argument_length()) and displays the result in the error message.

arg1, arg2

A character string with the argument name.

valid_values

A character vector with the valid values.

Value

Each function returns a classed error condition. abort_argument_type() returns a error_argument_type class, abort_argument_length() returns a error_argument_length class, abort_argument_diff_length() returns a error_argument_diff_length class and abort_argument_value() returns a error_argument_value class.

See Also

abort_column_not_found(), abort_no_method_for_class()


lvmisc documentation built on April 5, 2021, 5:06 p.m.