[R-SIG-Finance] [R-sig-finance] How to create seasonal variable for zoo object.
ggrothendieck at gmail.com
Sun Jun 21 18:17:27 CEST 2009
DF.dat <- read.table(URL, skip = 11)
TS2.dat <- zooreg(DF.dat[2:1], start = 1972.25, frequency = 4)
cyc <- factor(cycle(TS2.dat))
m <- model.matrix(~ cyc - 1)
TS3.dat <- cbind(TS2.dat, m)
On Sun, Jun 21, 2009 at 11:51 AM, Gabor
Grothendieck<ggrothendieck at gmail.com> wrote:
> On Sun, Jun 21, 2009 at 11:42 AM, Bogaso<bogaso.christofer at gmail.com> wrote:
>> Hi all, how to create a seasonal variable for a zoo object? For example I
>> have following dataset :
>> rm(list = ls())
> Please don't post code like that. Someone could download it and find out
> you had wiped out their workspace.
>> URL <- "http://www.jmulti.de//download/datasets/e6.dat"
>> dat1 <- readLines(URL)
>> dat11 <- dat1[-c(1:11)]
>> dat12 <- read.table(textConnection(dat11))
>> TS.dat <- zooreg(dat12[,c(2,1)], start = 1972.2, frequency = 4)
>> I want to create seasonal variable for each quarter for "TS.dat"
> Its not clear what is meant by "seasonal variable" but perhaps you
> are looking for cycle:
> cbind(TS.dat, cycle = cycle(TS.dat))
>> View this message in context: http://www.nabble.com/How-to-create-seasonal-variable-for-zoo-object.-tp24135743p24135743.html
>> Sent from the Rmetrics mailing list archive at Nabble.com.
>> R-SIG-Finance at stat.math.ethz.ch mailing list
>> -- Subscriber-posting only.
>> -- If you want to post, subscribe first.
More information about the R-SIG-Finance