On Mon, 6 Dec 2004 15:26:40 -0000 (GMT), [EMAIL PROTECTED] wrote : >I have just started using R for my PhD. I am importing my data from Excel >via notepad into Word. Unfortunately, my data has many missing values. I >have put '.' and this allowed me to import the data into R. However, I >now want to interpolate these missing values. Please can someone give me >some pointers as to the method/code I could use?
The approx() function does linear interpolation. For example: > x <- 1:10 > y <- c(1, NA, 3, NA, NA, 2, NA, NA, NA, NA) > > approx(x, y, xout = x) $x [1] 1 2 3 4 5 6 7 8 9 10 $y [1] 1.000000 2.000000 3.000000 2.666667 2.333333 2.000000 NA NA [9] NA NA To get it to extrapolate those values at the end, you could try "rule = 2", but this might not do what you want... Duncan Murdoch ______________________________________________ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html