Displaying 3 results from an estimated 3 matches for "maxgap".
2012 Jun 06
2
package zoo, function na.spline with option maxgap -> Error: attempt to apply non-function?
Hello,
I'm trying to use na.spline (package zoo) to fill some missing data in a time series.
this works fine, however, if I apply the 'maxgap' argument, I always get the error:
<------
Error in na.spline.vec(x., coredata(object.), xout = xout., ...) : attempt to apply non-function
------>
I couldn't find a similar error for this case in the mailing lists and zoo vignette, I hope I didn't
miss any basic thing, but as I...
2012 Apr 03
3
filling small gaps of N/A
Hi everybody,
I'm a new R french user. Sorry if my english is not perfect. Hope you'll
understand my problem ;)
I have to work on temperature data (35000 lines in one file) containing some
missing data (N/A). Sometimes I have only 2 or 3 N/A following each other,
but I have also sometimes 100 or 200 N/A following each other. Here's an
example of my data, when I have only small gaps
2012 Aug 01
0
how to use function of rle approx ifelse etc. in data frame
...;- function(x, maxlen){
runs <- rle(is.na(x$value))
if(any(runs$lengths[runs$values] >= maxlen)) NULL else x
}
library(plyr)
rem <- ddply(M2, .(ID, year, month), NA_run, 10)
As to the other two parts, I figured out if less than 5 NA, use:
na.locf(rem$value, na.rm=FALSE, maxgap=5); and if 5<NA<10,
use:approx(rem$value, n=length(rem$value))$y; however when I put them into
if else, it keeps failing me, is it because it is in data frame? I checked
many posts on this issue, but doesn't work on mine, any help would be
appreciated, thanks.
--
View this message in...