[R] Class for time of day?

Gabor Grothendieck ggrothendieck at gmail.com
Fri May 22 16:03:16 CEST 2009

You could create a subclass of times with its own print and format
methods that printed and formatted hours/minutes/seconds even if
greater than one day if that is the main item you need.

Regarding division you could contribute that to the chron package.
I've contributed a few missing items and they were incorporated.

Giving an error when it does not understand something would be
dangerous as it could break much existing code so that would
probably not be possible at this stage.
The idea of defaulting to internal representations is based on
the idea that you get many features for free since the way the
internal representations work gives the right answer in many
cases.   Its best to stick with the implicit philosophy that
underlies a package.  If you want a different philosophy then
its really tantamount to creating a new package.  I don't
think that one is right and the other wrong but simply
represent different viewpoints.

On Fri, May 22, 2009 at 9:33 AM, Stavros Macrakis <macrakis at alum.mit.edu> wrote:
> On Thu, May 21, 2009 at 8:28 PM, Gabor Grothendieck
> <ggrothendieck at gmail.com> wrote:
>> It uses hours/minutes/seconds for values < 1 day and uses days and
>> fractions
>> of a day otherwise.
> Yes, my examples were documenting this idiosyncracy.
>> For values and operations that it has not considered it falls back to
>> the internal representation.
> Yes, my examples were documenting this bad behavior.
>> Most of your examples start to make sense once you realize this.
> Of course I "realize" this.  That was the point of my examples.  I
> understand perfectly well what is *causing* the bad behavior.  That doesn't
> make it less bad.
> What is the point of a class system if functions ignore the class and
> perform meaningless calculations on the internal representation?
>             -s

More information about the R-help mailing list