[R] difftime result for days not an integer?

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Thu Feb 11 21:48:10 CET 2010


On Thu, Feb 11, 2010 at 8:40 PM, Jonathan <jonsleepy at gmail.com> wrote:
> Anybody have an idea why I would get a non-integer value for the
> number of days here?
>
>> difftime('2004-08-05','2001-01-03',units='days')
> Time difference of 1309.958 days
>
>
> Would you just round off?

It's one hour short of an integer number of days:

> difftime('2004-08-05','2001-01-03',units='hours')/24
Time difference of 1309.958 hours
> (1+difftime('2004-08-05','2001-01-03',units='hours'))/24
Time difference of 1310 hours

 why do you think that might be?

 here's another hint: a few years ago my birthday only lasted 23
hours. I never got that hour back.

Barry

-- 
blog: http://geospaced.blogspot.com/
web: http://www.maths.lancs.ac.uk/~rowlings
web: http://www.rowlingson.com/
twitter: http://twitter.com/geospacedman
pics: http://www.flickr.com/photos/spacedman



More information about the R-help mailing list