The values are stored as a difftime vector with a custom class, and always with "seconds" as unit for robust coercion to numeric. Supports construction from time values, coercion to and from various data types, and formatting. Can be used as a regular column in a data frame.
hms() is a high-level constructor that accepts second, minute, hour and day components
as numeric vectors.
new_hms() is a low-level constructor that only checks that its input has the correct base type, numeric.
is_hms() checks if an object is of class
as_hms() forwards to
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
hms(seconds = NULL, minutes = NULL, hours = NULL, days = NULL) new_hms(x = numeric()) is_hms(x) as_hms(x) ## S3 method for class 'hms' as.POSIXct(x, ...) ## S3 method for class 'hms' as.POSIXlt(x, ...) ## S3 method for class 'hms' as.character(x, ...) ## S3 method for class 'hms' format(x, ...) ## S3 method for class 'hms' print(x, ...)
Time since midnight. No bounds checking is performed.
additional arguments to be passed to or from methods.
hms, all arguments must have the same length or be
NULL. Odd combinations (e.g., passing only
hours but not
minutes) are rejected.
For arguments of type POSIXct and POSIXlt,
as_hms() does not perform timezone
lubridate::force_tz() as necessary.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.