Re: [R] compute time span in months between two dates Aydemir, Zava (FID) wrote: > Hi, >   > I am just starting to play with R. What is the recommended manner for > calculating time spans between 2 dates? In particular, should I be using > the "chron" or the "date" package (so far I just found how to calculate > a timespan in terms of days)? >   > Thanks >    I'd recommend something along these lines: d1 <- "11/03-1959" d2 <- "2/7-2007" f <- "%d/%m-%Y" as.numeric(as.Date(d2, f) - as.Date(d1, f), units="days") (The format in f needs to be adjusted to the actual format, of course.  For some formats, it can be omitted altogether). >   > Zava > -------------------------------------------------------- > > This is not an offer (or solicitation of an offer) to buy/se...{{dropped}} > > ______________________________________________ > 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 > and provide commented, minimal, self-contained, reproducible code. > ______________________________________________ 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 and provide commented, minimal, self-contained, reproducible code.