[R-SIG-Finance] [R-sig-finance] How to create seasonal variable for zoo object.

Gabor Grothendieck ggrothendieck at gmail.com
Sun Jun 21 17:51:34 CEST 2009


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))
> library(zoo)
> 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
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.
>



More information about the R-SIG-Finance mailing list