Re: [Rd] range() for Date and POSIXct could respect `finite = TRUE`

2023-05-22 Thread Martin Maechler
> Gabriel Becker > on Fri, 19 May 2023 09:23:50 -0700 writes: > Hi All, > I think there may be some possible confusion about what allowsInf would be > reporting (or maybe its just me :) ) if we did this. > Consider a class "myclass", S3, for starters, > with

Re: [Rd] range() for Date and POSIXct could respect `finite = TRUE`

2023-05-19 Thread Gabriel Becker
Hi All, I think there may be some possible confusion about what allowsInf would be reporting (or maybe its just me :) ) if we did this. Consider a class "myclass", S3, for starters, with setMethod("allowsInf", "myclass", function(obj) FALSE) Then, what would myclassthing <- structure(1.5, cla

Re: [Rd] range() for Date and POSIXct could respect `finite = TRUE`

2023-05-19 Thread Martin Maechler
> Bill Dunlap > on Thu, 11 May 2023 10:42:48 -0700 writes: >> What do others think? > I can imagine a class, "TemperatureKelvins", that wraps a > double but would have a range of 0 to Inf or one called > "GymnasticsScore" with a range of 0 to 10. For those > sort

Re: [Rd] range() for Date and POSIXct could respect `finite = TRUE`

2023-05-11 Thread Bill Dunlap
> What do others think? I can imagine a class, "TemperatureKelvins", that wraps a double but would have a range of 0 to Inf or one called "GymnasticsScore" with a range of 0 to 10. For those sorts of things it would be nice to have a generic that gave the possible min and max for the class inste

Re: [Rd] range() for Date and POSIXct could respect `finite = TRUE`

2023-05-11 Thread Martin Maechler
> Davis Vaughan > on Tue, 9 May 2023 09:49:41 -0400 writes: > It seems like the main problem is that `is.numeric(x)` > isn't fully indicative of whether or not `is.finite(x)` > makes sense for `x` (i.e. Date isn't numeric but does > allow infinite dates). > So I

Re: [Rd] range() for Date and POSIXct could respect `finite = TRUE`

2023-05-09 Thread Davis Vaughan via R-devel
It seems like the main problem is that `is.numeric(x)` isn't fully indicative of whether or not `is.finite(x)` makes sense for `x` (i.e. Date isn't numeric but does allow infinite dates). So I could also imagine a new `allows.infinite()` S3 generic that would return a single TRUE/FALSE for whether

Re: [Rd] range() for Date and POSIXct could respect `finite = TRUE`

2023-05-04 Thread Martin Maechler
> Davis Vaughan > on Mon, 1 May 2023 08:46:33 -0400 writes: > Martin, > Yes, I missed that those have `Summary.*` methods, thanks! > Tweaking those to respect `finite = TRUE` sounds great. It seems like > it might be a little tricky since the Summary methods call

Re: [Rd] range() for Date and POSIXct could respect `finite = TRUE`

2023-05-01 Thread Davis Vaughan via R-devel
Martin, Yes, I missed that those have `Summary.*` methods, thanks! Tweaking those to respect `finite = TRUE` sounds great. It seems like it might be a little tricky since the Summary methods call `NextMethod()`, and `range.default()` uses `is.numeric()` to determine whether or not to apply `finit

Re: [Rd] range() for Date and POSIXct could respect `finite = TRUE`

2023-04-29 Thread Martin Maechler
> Davis Vaughan via R-devel > on Fri, 28 Apr 2023 11:12:27 -0400 writes: > Hi all, > I noticed that `range.default()` has a nice `finite = > TRUE` argument, but it doesn't actually apply to Date or > POSIXct due to how `is.numeric()` works. Well, I think it would / s

Re: [Rd] range() for Date and POSIXct could respect `finite = TRUE`

2023-04-28 Thread Tim Taylor
A tiny nit-pick nit-pick: I'd take NA to mean the finish date is missing and you know neither whether the event has finished or if it has finished at all :-) Either way the proposed method seems sensible. Tim On 28/04/2023 16:29, Paul McQuesten wrote: A tiny nit-pick: Seems to me that end da

Re: [Rd] range() for Date and POSIXct could respect `finite = TRUE`

2023-04-28 Thread Paul McQuesten
A tiny nit-pick: Seems to me that end date = NA would mean the event has not yet ended, whilst Inf would mean that the event is known to never terminate, ie: an eternal fact, or physical law. On Fri, Apr 28, 2023 at 10:12 AM Davis Vaughan via R-devel < r-devel@r-project.org> wrote: > Hi all, > >