[R] Time difference in months? (difftime, units)

From: Andy Bunn <abunn_at_whrc.org>
Date: Thu 18 Nov 2004 - 02:26:06 EST


Is there a way to calculate the number of months between dates?

StartDate <- strptime("01 March 1950", "%d %B %Y") EventDates <- strptime(c("01 April 1955", "01 July 1980"), "%d %B %Y") difftime(EventDates, StartDate)

So, there are 61 months between 01 March 1950 and 01 April 1955. There are 364 months between 01 March 1950 and 01 July 1980. What I want is for there to be a "months" argument to units in difftime. Anybody have a bright idea? Is there a better way to approach this than difftime?

Thanks in advance, Andy

> version

         _
platform i386-pc-mingw32

arch     i386
os       mingw32

system i386, mingw32
status
major 2
minor 0.0
year 2004
month 10
day 04
language R

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Nov 18 02:43:13 2004

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 01:19:53 EST