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
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, > StellaTry 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
Possibly Parallel Threads
- Huge data sets and RAM problems
- Help on aggregate method
- R Processing dataframe by group - equivalent to SAS by group processing with a first. and retain statments
- R Processing dataframe by group - equivalent to SAS by group processing with a first. and retain statments
- R Processing dataframe by group - equivalent to SAS by group processing with a first. and retain statments