| assert_all_are_after {assertive.datetimes} | R Documentation |
Checks to see if the input is a time in the past/future, or before/after some time point.
assert_all_are_after(x, y, na_ignore = FALSE,
severity = getOption("assertive.severity", "stop"))
assert_any_are_after(x, y, na_ignore = FALSE,
severity = getOption("assertive.severity", "stop"))
assert_all_are_before(x, y, na_ignore = FALSE,
severity = getOption("assertive.severity", "stop"))
assert_any_are_before(x, y, na_ignore = FALSE,
severity = getOption("assertive.severity", "stop"))
assert_all_are_in_future(x, na_ignore = FALSE,
severity = getOption("assertive.severity", "stop"))
assert_any_are_in_future(x, na_ignore = FALSE,
severity = getOption("assertive.severity", "stop"))
assert_all_are_in_past(x, na_ignore = FALSE,
severity = getOption("assertive.severity", "stop"))
assert_any_are_in_past(x, na_ignore = FALSE,
severity = getOption("assertive.severity", "stop"))
is_after(x, y, .xname = get_name_in_parent(x),
.yname = get_name_in_parent(y))
is_before(x, y, .xname = get_name_in_parent(x),
.yname = get_name_in_parent(y))
is_in_future(x, .xname = get_name_in_parent(x))
is_in_past(x, .xname = get_name_in_parent(x))
x |
|
y |
Another date-time object to compare against. |
na_ignore |
A logical value. If |
severity |
How severe should the consequences of the assertion be?
Either |
.xname |
Not intended to be used directly. |
.yname |
Not intended to be used directly. |
The current time is determined by Sys.time, and the
input is coerced to POSIXct format if necessary.
The is_* function return TRUE if the input is
a time in the future/past. The assert_* functions return nothing but
throw an error if the corresponding is_* function returns
FALSE.
Note that the print method for POSIXct objects means that the
cause attribute (in the event of failures) is not shown. You can still
access it via, e.g., cause(is_in_past(x)).
x <- Sys.time() + c(-1, 100)
is_in_past(x)
is_in_future(x)
# more generally, compare against any date-time
is_before(x, as.POSIXct("9999-12-31"))
is_after(x, as.POSIXct("0001-01-01"))