Lubridate starts out answering a simple question—is it AM or PM, based on a date and hour? From there, it gets more complex but maintains a consistent approach to working with dates, times, and the combination date-times.
© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2021
W. YarberryCRAN Recipeshttps://doi.org/10.1007/978-1-4842-6876-6_33. Lubridate: Date and Time Processing
William Yarberry1
(1)
Kingwood, TX, USA
if (!require("lubridate")) install.packages("lubridate")
bk.coffee.time <- as.POSIXct("080418 10:11",
format = "%y%m%d %H:%M")
am(bk.coffee.time)
## [1] TRUE
bk.time.span <- interval(ymd("2019-01-01"), ymd("2019-06-30"))
bk.time.span.value <- as.duration(bk.time.span)
Get CRAN Recipes: DPLYR, Stringr, Lubridate, and RegEx in R now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.