On Wed, Jun 6, 2012 at 4:40 PM, May Katharina <may.kathar...@googlemail.com> wrote: > On Jun 6, 2012, at 10:19 , Gabor Grothendieck wrote: > >> On Wed, Jun 6, 2012 at 3:55 PM, May Katharina >> <may.kathar...@googlemail.com> wrote: >>> 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 don't know how to proceed, any help on why >>> this isn't working >>> is very much appreciated (I guess I don't have to mention I'm new to time >>> series & zoo and that I'm terrible sorry if this is >>> an absolute dull question). >>> >>> The data I use is rather large, but the error can be reconstructed in a >>> small example (s. below). >>> If of any interest: I use R 2.15.0 GUI 1.51 Leopard build 32-bit (6148). >>> >>> Many thanks and best regards, Katharina >>> >>>
Yes, it seems that that bug hid a second bug and I have now hopefully removed both. Try this (or download and build the zoo package from R-Forge): > library(zoo) > > # source revised code > source("http://r-forge.r-project.org/scm/viewvc.php/*checkout*/pkg/zoo/R/na.spline.R?root=zoo") > source("http://r-forge.r-project.org/scm/viewvc.php/*checkout*/pkg/zoo/R/na.approx.R?root=zoo") > na.spline(z, maxgap = 2) 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1 2 3 4 NA NA NA 8 9 10 11 12 13 14 NA NA 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 NA 18 19 20 21 22 23 24 25 26 27 28 29 30 > -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com ______________________________________________ R-help@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.