[R] difference between 2 dates: IN MONTHS the way Mothers compute it

davidr at rhotrading.com davidr at rhotrading.com
Fri Mar 10 21:52:44 CET 2006


I just solved this for dealing with deliverables for the CBOT's treasury
futures. 

    length(seq(from=x, to=y, by="months"))-1

David L. Reiner
 

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-
> bounces at stat.math.ethz.ch] On Behalf Of Smith, Phil
> Sent: Friday, March 10, 2006 12:20 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] difference between 2 dates: IN MONTHS the way Mothers
compute
> it
> 
> Hi R-people:
> 
> I need a function to compute the number of months between 2 dates, in
the
> same way a mother would do it.
> 
> For example, if a kid is born on February 6, the number of months
between
> that date and March 7 is exactly 1 month, although it is only 29 days.
> 
> Thank you!
> Phil Smith
> CDC
> 
> 
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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




More information about the R-help mailing list