# NOT RUN {
x <- c(1, 2, 2, 1, 3, 2)
is_monotonic_increasing(x)
is_monotonic_increasing(x, TRUE)
is_monotonic_decreasing(x)
is_monotonic_decreasing(x, TRUE)
# Also works with, e.g., dates & times
is_monotonic_increasing(Sys.time() + x)
# These checks should fail
assertive.base::dont_stop({
assert_is_monotonic_increasing(x)
assert_is_monotonic_decreasing(x)
})
# }
Run the code above in your browser using DataLab