[R] Basic NA handling problem

From: Sumanta Basak <r_econometrics_at_yahoo.co.in>
Date: Thu 22 Jun 2006 - 15:54:53 EST


Hi All,

I need your help in NA handling.

I've following data series.

x<-c(1,4,5,8,NA,4,NA,5,5,1,2,7,8,9,NA,NA,NA,15,6,8)

Now i want to interpolate where NA value persists. Like, between 9 and 5 there are three NA's. So, that should be interpolated like,

1st NA-> (15-9)/4
2nd NA-> 1st NA value + (15-9)/4

Can i get help on this using a 'for' loop. Actually i have huge daily time series with lots of NA values where i need to make these values.

Please help.

Thanks,
Sumanta Basak.                                  


        [[alternative HTML version deleted]]



R-help@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 Received on Thu Jun 22 17:23:24 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 22 Jun 2006 - 18:11:22 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.