[R] filling small gaps of N/A

jeff6868 geoffrey_klein at etu.u-bourgogne.fr
Wed Apr 4 10:20:40 CEST 2012


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.



More information about the R-help mailing list