dtt_diff | R Documentation |
Gets the time difference in secs, minutes, hours, days or weeks. Uses difftime() but floors x and y first after coercing to POSIXct and adjusts the timezone of y to match that of x.
dtt_diff(x, y, units = "secs", as_difftime = FALSE)
x |
An object that can be coerced to a POSIXct using dtt_date_time(). |
y |
An object that can be coerced to a POSIXct using dtt_date_time(). |
units |
A string of the time units. The possible values are "secs", "minutes", "hours", "days" or "weeks". |
as_difftime |
A flag specifying whether to return a difftime vector. |
A numeric vector of the time difference.
dtt_diff(
as.Date(c("2001-01-02", "2000-12-31")),
as.Date("2001-01-01"),
"hours"
)
dtt_diff(as.Date("2001-01-02"), as.Date("2001-01-01"), "weeks")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.