# No error
input = 5
arg_match0_integer(input, values = c(0:5))
# Allow NA
input = NA
arg_match0_integer(input, values = c(0:5))
# Error as 0 is not within 0 and 5
input = 6
try(arg_match0_integer(input, values = c(0:5)))
# Error as NULL is not within 0 and 5
input = NULL
try(arg_match0_integer(input, values = c(0:5)))
# Error as NA is not within 0 and 5 and allow_na is FALSE
input = NA
try(arg_match0_integer(input, values = c(0:5), allow_na = FALSE))
Run the code above in your browser using DataLab