The warning message simply indicates that you have more than one data point with the same "x" value. So, `approx' collapses over the dulicate x values by averaging the corresponding "y" values. I am not sure if this is your problem - it doesn't seem like it. It is doing what seems reasonable for a linear interpolation. If you have some idea of how the interpolation should look like, you may fit a model to the data and impute based on the model.
Ravi. ---------------------------------------------------------------------------- ------- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: rvarad...@jhmi.edu Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty_personal_pages/Varadhan.h tml ---------------------------------------------------------------------------- -------- -----Original Message----- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of ogbos okike Sent: Thursday, January 28, 2010 12:30 PM To: r-help@r-project.org Subject: [R] Interpolation Happy New Year. I have a data of four columns - year, month, day and count. The last column, count, contains some missing data which I have to replace with NA. I tried to use the method of interpolation to assign some values to these NA so that the resulting plot will be better. I used x to represent date and y to represent count. With the method below, I tried to interpolate on the NA's, but that resulted in the warning message below. I went ahead and plotted the graph of date against count (plot attached). The diagonal line between May and Jul is not looking good and I suspect that it is the result of the warning message. It would be appreciated if anybody could give me some help. Warmest regards Ogbos > y1<-approx(x,y,xout = x)$y Warning message: In approx(x, y, xout = x) : collapsing to unique 'x' values ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.