View source: R/daytime__class.R
as_daytime | R Documentation |
Retrieve minute of day
as_daytime(x, ...) ## S3 method for class 'POSIXt' as_daytime(x, rational = FALSE, ...) ## S3 method for class 'numeric' as_daytime(x, rational = attr(x, "rational"), ...) ## S3 method for class 'circular' as_daytime(x, rational = attr(x, "rational"), warn_circular = TRUE, ...) ## S3 method for class 'character' as_daytime(x, rational = FALSE, ...) ## S3 method for class 'integer' as_daytime(x, ...)
x |
value from which to determine the minute of day value; typically
inherits from |
... |
arguments passed to |
rational |
logical. If |
warn_circular |
logical. Issue a warning if class |
If x
inherits from character
, casting to POSIXt
will be attempted. Arguments can be passed to as.POSIXct
to assist
with this, notably the format
and tz
arguments. Presumably
the timezone should not matter, except perhaps during a daylight saving
transition hour. But it is always safest to pass in POSIX-formatted data
that you have vetted yourself.
a daytime
object
t1_char <- "00:01:30" t1 <- as.POSIXct(t1_char, "UTC", format = "%H:%M:%S") ## Methods exist to give comparable output from character and POSIX inputs as_daytime(t1_char, format = "%H:%M:%S") as_daytime(t1) as_daytime(t1, TRUE) ## Beware of silent timezone changes. System will ## assume your local timezone unless told otherwise! as_daytime( strftime(t1, "%H:%M:%S", "EST"), format = "%H:%M:%S" )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.