Re: [Rd] round.Date and trunc.Date not working / implemented

2024-02-09 Thread Duncan Murdoch
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

Re: [Rd] round.Date and trunc.Date not working / implemented

2024-02-09 Thread Jiří Moravec
> 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

Re: [Rd] round.Date and trunc.Date not working / implemented

2024-02-09 Thread Jiří Moravec
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