Description Usage Arguments Details Examples
It derives from numeric and internally represents time in "seconds". Conceptually very close to hms::hms, but with day values and arithmetics operations. Supports construction from formatted string, coercion to and from various data types. Can be used as a regular column in a data frame.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | dhms(seconds = NULL, minutes = NULL, hours = NULL, days = NULL)
as.dhms(x, ...)
## Default S3 method:
as.dhms(x, ...)
## S3 method for class 'difftime'
as.dhms(x, ...)
## S3 method for class 'numeric'
as.dhms(x, ...)
## S3 method for class 'character'
as.dhms(x, ...)
## S3 method for class 'dhms'
as.character(x, ...)
## S3 method for class 'dhms'
format(x, ...)
## S3 method for class 'dhms'
print(x, ...)
|
seconds, minutes, hours, days |
Time since ZT0. No bounds checking is performed. |
x |
An object. |
... |
Arguments passed on to further methods. |
For dhms
, all arguments must have the same length or be
NULL
. Odd combinations (e.g., passing only seconds
and
hours
but not minutes
) are rejected.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | print(c(dhms(56, 34, 12),dhms(56, 34, 12)))
dhms(56, 34, 12,1)
as.dhms(3600 * 2 + 60* 23+ 59 )
as.dhms("-1d 12:34:56")[1]
as.dhms(Sys.time())
dhms(102031) - "20:00:00"
dhms(20) == "00:00:20"
dhms(21) > "00:00:20"
dhms(19) < "00:00:20"
print(as.dhms("0.5d"))
print(-dhms(56, 34, 12,1))
## Not run:
# we expect ERRORS in the folowing cases
as.dhms("0.5d 21:00:00") # decimal days and hours
as.dhms("1d 64:00:00") # more than 24h, and days
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.