[R-SIG-Finance] interpolating missing values from a TS
Aleks Clark
aleks.clark at gmail.com
Wed Oct 7 11:23:17 CEST 2009
I've got a large TS with occasional NAs I'd like to roughly
interpolate, I'm currently doing this but it's pretty slow:
lapply(1:nrow(delta), function(i) {
lapply(1:ncol(delta), function(j) {
if (is.na(delta[i,j])) {
if ((i==1)||is.na(delta[i-1,j])) {
delta[i,j] <- delta[i+1,j]
} else { delta[i,j] <- delta[i-1,j]}
}
})
})
any ideas for a better solution?
--
Aleks Clark
More information about the R-SIG-Finance
mailing list