[R] Interpolation

stephen sefick ssefick at gmail.com
Thu Jan 28 19:19:43 CET 2010


Why not look into the zoo package na.approx? And related functions.

On Thu, Jan 28, 2010 at 11:29 AM, ogbos okike <ogbos.okike at gmail.com> wrote:
> 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 at 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.
>
>



-- 
Stephen Sefick

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

								-K. Mullis



More information about the R-help mailing list