I have a zooreg object and I want to be able to generate a value for seasons
and 11-day composites paste it onto my zoo data frame, along with year,
month and days.

Right now I have the following to work from:

eg. dat.zoo.mdy <- with(month.day.year(time(dat.zoo)), cbind(dat.zoo, year,
month, day, quarter = (month - 1) %/% 3 + 1, dow =
as.numeric(format(time(dat.zoo), "%w"))))

For the seasons, I have been trying to replace 'quarter' with a seasonal
value of "1" for Dec-Jan-Feb, "2" for Mar-Apr-May, "3" for Jun-Jul-Aug, "4"
for Sep-Oct-Nov.

dat.zoo.mdy <- with(month.day.year(time(dat.zoo)), cbind(dat.zoo, year,
month, day,
season=for(i in nrow(dat.zoo.mdy)) {
         if (month[i] == 12) {
         quarter[i]=1
         } else if (month[i] == 3) {
         quarter[i]=2
         } else if (month[i] == 6) {
         quarter[i]=3
         } else quarter[i]=4 }, dow = as.numeric(format(time(dat.zoo),
"%w"))))

However, this gives me the error: "Error in zoo(structure(x, dim = dim(x)),
index(x), ...) :
  “x” : attempt to define illegal zoo object"

I'd like to get an 11-day value as well to replace the dow in the first
example, but I'm still trying to figure out if there is an easy way to do
this in zoo.

Any ideas would be greatly appreciated.

Katrina

        [[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