[R-SIG-Finance] zoo: how to find for series x closest day in series y?
matthieu.stigler at gmail.com
Fri Apr 23 11:10:19 CEST 2010
I have two series, x and y, which don't have the same index. I then
need to find which in y is the closest day in x. How can do I do this in
a clean way? I have here a dirty for loop solution...
x<-zoo(1:3,as.Date(c("1992-12-13", "1997-05-12", "1997-07-13")))
#but index is not always the same:
#my (dirty?) solution
for(i in which(!index(x)%in%index(y)))
Is there something cleaner one could use to find the closest available day?
Thanks a lot!
More information about the R-SIG-Finance