x <- 1.1
check_positive(x)
x <- 1L
check_positive(x)
if (FALSE) {
# `x` must be a numeric
x <- "1"
check_positive(x)
# `x` must have length 1
x <- 1:2
check_positive(x)
# `x` must not be `NA`
x <- NA_integer_
check_positive(x)
# `x` must be larger than 0
x <- -1
check_positive(x)
# make `0` acceptable
x <- 0
check_positive(x)
check_positive(x, zero = TRUE)
}
Run the code above in your browser using DataLab