I have the following time series
> y<- xts(1:10, Sys.Date()+1:10) > y[c(1,2,5,9,10)] <- NA > y [,1] 2011-09-04 NA 2011-09-05 NA
Use na.approx from the zoo package (which is automatically loaded by xts):
na.approx
na.approx(y, method = "constant", na.rm = FALSE)