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

2024-02-08 Thread Duncan Murdoch
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 On 08/02/2024 12:23 p.m., Henrik Bengtsson wrote: Technically, there is a round()

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

2024-02-08 Thread Henrik Bengtsson
Technically, there is a round() for 'Date' objects, but it doesn't seem very useful, because it basically just fall back to the default round() method, which only takes the 'digits' argument. Here's an example: > date <- Sys.Date() > class(date) [1] "Date" We see that there are only two round()

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

2024-02-08 Thread Rui Barradas
Às 14:36 de 08/02/2024, Olivier Benz via R-devel escreveu: On 8 Feb 2024, at 15:15, Martin Maechler wrote: Jiří Moravec on Wed, 7 Feb 2024 10:23:15 +1300 writes: This is my first time working with dates, so if the answer is "Duh, work with POSIXt", please ignore it. Why is not `round

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

2024-02-08 Thread Aidan Lakshman
I just wanted to add some additional problems from trying to replicate this. `trunc` does indeed work as advertised here, as does calling `round.POSIXt(Sys.Date())` and `round(Sys.Date())`. These functions are definitely implemented. However, I am also able to replicate Jiří’s error: ``` > round

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

2024-02-08 Thread Olivier Benz via R-devel
> On 8 Feb 2024, at 15:15, Martin Maechler wrote: > >> Jiří Moravec >>on Wed, 7 Feb 2024 10:23:15 +1300 writes: > >> This is my first time working with dates, so if the answer is "Duh, work >> with POSIXt", please ignore it. > >> Why is not `round.Date` and `trunc.Date` "implement

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

2024-02-08 Thread Martin Maechler
> Jiří Moravec > on Wed, 7 Feb 2024 10:23:15 +1300 writes: > This is my first time working with dates, so if the answer is "Duh, work > with POSIXt", please ignore it. > Why is not `round.Date` and `trunc.Date` "implemented" for `Date`? > Is this because `Date` is (