[R] Question about difftime()

Stella Pachidi stella.pachidi at gmail.com
Thu May 20 18:08:12 CEST 2010


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

--
Stella Pachidi
Master in Business Informatics student
Utrecht University



More information about the R-help mailing list