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 ______________________________________________ R-help@r-project.org 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.