#' # Create an assertion function that checks that a character string is all
# lower case
assert_character <- assert_create(
is.character,
"{arg_name} must be a character vector, not a {class(arg_value)}"
)
# Use the assertion function
try({
is_lower("hello") # Returns invisible TRUE
is_lower("Hello") # Aborts the function with the error message
})
Run the code above in your browser using DataLab