has_warning(c(1, "no"), as.integer)
# 1 no
# FALSE TRUE
get_warning(c(1, "no"), as.integer)
# drop NULLs
get_warning(c(1, "no"), as.integer, .null = FALSE)
foo <- function(x) {
stopifnot(x > 0)
x
}
has_error(c(1, 0, 2), foo)
# 1 0 2
# FALSE TRUE FALSE
get_error(c(1, 0, 2), foo)
# drop NULLs
get_error(c(1, 0, 2), foo, .null = FALSE)
Run the code above in your browser using DataLab