[R] time between two dates
Berend Hasselman
bhh at xs4all.nl
Fri Mar 9 10:28:24 CET 2012
On 09-03-2012, at 10:04, carol white wrote:
> Dear All,
> It may be a trivial question but how to determine the number of days between two dates? What I want to do is to subtract two dates by a function which returns the number of days between these two dates.
>
> 11.11.2008-11.11.2006 ~= 730 days
>
x <- as.Date(c("11-11-2008","11-11-2006"),format="%d-%m-%Y")
difftime(x[1],x[2],units="days")
Berend
More information about the R-help
mailing list