On 08/02/2024 7:58 p.m., Jiří Moravec wrote:
> This is a workaround, and could be the basis for a round.Date
improvement:
> date <- Sys.Date()
> as.Date(round(as.POSIXct(date), "years"))
> as.Date(round(as.POSIXct(Sys.Date() + 180), "years"))
> Duncan Murdoch
That would work, per
> This is a workaround, and could be the basis for a round.Date
improvement:
> date <- Sys.Date()
> as.Date(round(as.POSIXct(date), "years"))
> as.Date(round(as.POSIXct(Sys.Date() + 180), "years"))
> Duncan Murdoch
That would work, perhaps structured similarly as `trunc.Date` is.
The only
Apologies then. I was using R version 4.1.2 (Bird Hippie) and looks like
someone implemented a better trunc.Date version in the meantime.
# v4.1.2
> trunc.Date
function (x, ...)
round(x - 0.499)
# Unstable (2024-02-07 r85873)
> trunc.Date
function (x, units = c("secs", "mins", "hours", "d