[R] completing missing samples

Gabor Grothendieck ggrothendieck at gmail.com
Sun Sep 18 12:01:13 CEST 2011


On Mon, Sep 12, 2011 at 4:42 AM, Eran Eidinger <eran at taykey.com> wrote:
> Hello,
>
> I have a time-series that has some missing samples.
> I was thinking on completing them using either zero-order hold or linear
> interpolation.
> I am looking for an efiicient way (other than a loop...) of identifiying the
> missing time slots and filling them.
>
> Can you think of any methods that might help here? (obviously
> which(diff(time)>min(diff(time))) will give the locations, but what
> then....?)
>

The zoo package has na.approx, na.fill, na.locf, na, na.spline
na.StructTS and the stinepack package has na.stinterp.  Each of these
fill in NAs in zoo series and certain other objects.  See the help
files for many examples.


-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-help mailing list