I don't seem to have that method: > zts = as.ts.zoo(z) Error: could not find function "as.ts.zoo"
I'm finding forum posts from people trying to use stl directly with zoo[reg] functions (despite the documentation specifying ts) but discovering that stl gives errors with NA entries. I encountered similar errors. Can anyone on this list confirm whether stl works with NA values? If so, could someone please point me to a working example? On Tue, Jan 18, 2011 at 8:06 PM, Gabor Grothendieck <ggrothendi...@gmail.com > wrote: > On Tue, Jan 18, 2011 at 6:33 PM, Adam Oliner <oli...@gmail.com> wrote: > > Hi, > > > > I'm trying to make a ts object that has both NA values and a frequency > other > > than 1 (so I can use stl). I've tried all permutations I can think of, > but > > cannot get the desired (expected?) results. > > > > The values live in x and the corresponding semi-regular time stamps are > in > > t: > > > >> library('zoo') > >> z = zoo(x, order.by=t, frequency=24) > >> zzr = as.zooreg(z, start=0) > >> zr = zooreg(x, order.by=t, start=0, frequency=24) > >> zrz = as.zoo(zr) > > > > The objects z, zr, and zzr all have frequency 24, as desired, and plot > > correctly. Object zrz plots correctly but has frequency 1. Now I try to > make > > it a ts object: > > > >> zrt = ts(zzr) > > ... omits the missing values. > >> zrt = ts(zzr, frequency=24) > > ... omits the missing values and changes the timestamps. > >> plot(ts(zr)) > > ... omits the missing values. > >> zrt = ts(zr, frequency=24) > > ... omits the missing values and changes the timestamps. > >> zrt = as.ts(zr) > > ... inserts 23 NA values between each legitimate value. > >> zrt = as.ts(zr, frequency=24) > > ... inserts 23 NA values between each legitimate value. > >> zrzt = ts(zrz) > > ... omits the missing values. > >> zrzt = ts(zrz, frequency=24) > > ... omits the missing values and changes the timestamps. > > > > Note that there is an as.ts.zoo method. > > > -- > Statistics & Software Consulting > GKX Group, GKX Associates Inc. > tel: 1-877-GKX-GROUP > email: ggrothendieck at gmail.com > -- - Adam J. Oliner [[alternative HTML version deleted]] ______________________________________________ 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.