Skip to content
Prev 156505 / 398506 Next

Trouble with difftime()

I apologize, my original google searches were insufficient to turn up this
archived message:

http://tolstoy.newcastle.edu.au/R/help/06/04/24642.html

...in which my question is answered. Yes, this is the expected behavior,
because range() is designed to operate on difftime objects with any
unit...and it does so by converting to the theoretically-smallest unit.

My (and that poster's) confusion is likely due to the fact that, for cases
where seconds is not the highest common factor, the conversion is
surprising.

I think part of my surprise is also due to the fact that using the lowest
common multiple doesn't necessarily seem appropriate; why not, for instance,
convert everything to days, to weeks, or to the smallest or largest unit
passed to the summary function?

Also, please note here that I am not intending to whine or complain about
the functionality here, I'm just trying to understand it--much better to
convert all vectors to the same unit (ANY unit!). Having a better idea of
why choices like this have been made in R's user interface help me to better
"guess" what's up, to be able to solve my problems faster, and on my own.

--Adam
On Thu, 18 Sep 2008, Adam D. I. Kramer wrote: