assert_vector {gtfsio} | R Documentation |
Assert that an input is a vector/list with desired properties
Description
Assert that an input is a vector/list with desired properties
Usage
assert_vector(
x,
class,
len = NULL,
null_ok = FALSE,
var_name = NULL,
subset_of = NULL,
named = FALSE,
n_call = -1L
)
assert_list(x, len = NULL, null_ok = FALSE, named = FALSE)
assert_class(x, class, n_call = -1)
Arguments
x |
A vector/list. The input to be analysed. |
class |
A string. The class that this input should inherit from. |
len |
An integer. The length of the vector. If |
null_ok |
A logical. Whether the input could also be |
var_name |
A string. The name of the variable in the informative
message. If |
subset_of |
A character vector. If |
named |
A logical. Whether the input should be a named vector/list. If
|
n_call |
A negative integer. The number of frames to go back to find the call to associate the error generated by the function with. Defaults to the parent frame (-1). This argument is only relevant to other assertion functions that build on top of this one. |
Value
TRUE
if the check is successful. Throws an error describing the
issue with the input otherwise.