Description Usage Arguments Details Value Note See Also Examples
Checks to see if the input is a time in the past/future, or before/after some time point.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | 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.
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))
.
1 2 3 4 5 6 7 8 | datetime <- Sys.time() + c(-1, 100)
is_in_past(datetime)
is_in_future(datetime)
date <- Sys.Date() + c(-1, 100)
# more generally, compare against any date-time
is_before(datetime, as.POSIXct("9999-12-31"))
is_after(datetime, as.POSIXct("0001-01-01"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.