[R] Odp: number of days

Petr PIKAL petr.pikal at precheza.cz
Mon May 14 12:08:39 CEST 2007


Hi

it will partly depend on which format of dates you use but usually it is 
as easy as

> dates <- c("02/27/92", "02/27/92", "01/14/92", "02/28/92", "02/01/92")
> ddd<-as.Date(dates, "%m/%d/%y")
> diff(ddd)
Time differences in days
[1]   0 -44  45 -27
> Sys.Date()-ddd
Time differences in days
[1] 5555 5555 5599 5554 5581
>

Regards

Petr
petr.pikal at precheza.cz

r-help-bounces at stat.math.ethz.ch napsal dne 14.05.2007 11:16:10:

> 
> Hi, some of you knows how to calculate in R the number of days between 
given
> dates? 
> issue relevant in option pricing
> thanks, robert
> -- 
> View this message in context: 
http://www.nabble.com/number-of-days-tf3751163.
> html#a10600371
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> 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
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list