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.

Could someone tell me how to get the desired ts object?

Sincerely,
-- 
 - 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.

Reply via email to