[R] Question about difftime()
Marc Schwartz
marc_schwartz at me.com
Thu May 20 18:33:33 CEST 2010
On May 20, 2010, at 11:08 AM, Stella Pachidi wrote:
> Dear R experts,
>
> I have a question about the result of difftime() function: Does it
> take into account the different number of days in each month. In my
> example, I have the following:
>
>> firstDay
> [1] "2010-02-20"
>> lastDay
> [1] "2010-05-20 16:00:00"
>> difftime(lastDay,firstDay,units='days')
> Time difference of 89.625 days
>>
>
> When I count the days I get 88 days from 20/02/2010 to 20/05/2010
> consequently the difference in days should be 87.
>
> On the contrary, difftime gives a higher number, so I doubt whether it
> takes into account the fact that february has 28 days (or 29). Could
> you please help?
>
> Thank you very much in advance.
>
> Kind regards,
> Stella
Try recounting:
8 days remaining in February this year (not a leap year), after the 20th.
31 days in March
30 days in April
20 days in May
Total?
HTH,
Marc Schwartz
More information about the R-help
mailing list