[R] filling small gaps of N/A

R. Michael Weylandt michael.weylandt at gmail.com
Wed Apr 4 15:00:24 CEST 2012


No problem -- best of luck with it: the zoo package is one of the best
documentation-wise and I'd advise you to look at the available
vignettes when you have time.

Vignettes are extended documentation included in some packages that
give a more systematic presentation than can be given in the help
pages. vignette() [no arguments] at the command line will bring up a
list of all the vignettes available on your computer: alternatively,
you can see them on CRAN here:
http://cran.r-project.org/web/packages/zoo/index.html

Best,
Michael

On Wed, Apr 4, 2012 at 4:20 AM, jeff6868
<geoffrey_klein at etu.u-bourgogne.fr> wrote:
> Wow, thank you for all your answers.
>
> You were completely right michael. Well, it's my fault. I didn't understood
> your 2nd reply, when you were talking about arguments for larger gaps. I
> thought it was for deleting big gaps too. I apologize.
> It was too easy in fact. I also didn't noticed the argument "maxgap" of the
> function.
> Finally, it works perfectly only with this:
>
> require(zoo)
>
>    imputation <- function(x){
>    met <- na.approx(x, maxgap = 4)
>
>    return(met)
>    }
>
>    data <- myts[,2:5]
>    myts[,2:5]<-apply(data,2,imputation)
>
> Sorry for my stupidity. I'll try to be more careful next time, for such
> small problems (when I was thinking it would be a big one) ;).
> Well, thank you very much michael and the other repliers, and thank you for
> having spared a bit of your time for me!
>
> --
> View this message in context: http://r.789695.n4.nabble.com/filling-small-gaps-of-N-A-tp4528184p4531224.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.



More information about the R-help mailing list