On Fri, May 22, 2009 at 12:28 PM, Gabor Grothendieck <
ggrothendi...@gmail.com> wrote:

...The way this might appear in code is if someone wanted to calculate the
> number of one hour intervals in 18 hours.  One could write:
>
> t18 <- times("18:00:00")
> t1 <- times("1:00:00")
> as.numeric(t18) / as.numeric(t1)
>
> but since we all know that it uses internal representations unless it
> indicates otherwise


Um, yes, I suppose that was the attitude in the 60's and 70's, but I think
we have moved on from there.  cf.
http://en.wikipedia.org/wiki/Data_abstraction


> a typical code snippet might shorten it to:
>
> as.numeric(t18 / t1)
>
> and all such code would break if one were to cause that to generate an
> error.
>

(18/24 day)/(1/24 day) is the perfectly meaningful dimensionless number 18,
so this code should not break with a correct implementation of '/'.  (cf.
http://en.wikipedia.org/wiki/Dimensional_analysis).  Alas, chron gives the
nonsense result of 18 days.

            -s

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to