[R] zooreg and window

From: Katrina Bennett <kebennett_at_alaska.edu>
Date: Wed, 13 Apr 2011 11:18:08 -0800


Hello, I have a following time series data

head(mend.dat)

ID PARAM Year Month Day Value SYM

1 15052500     1 1965     5  15   128   A
2 15052500     1 1965     5  16   135   A
3 15052500     1 1965     5  17   157   A
4 15052500     1 1965     5  18   176   A
5 15052500     1 1965     5  19   198   A
6 15052500     1 1965     5  20   241   A


I have loaded these data into as a zooreg object. The entire time series runs from 1965-05-15 until 2010-12-31.

I have generated dates using ISOdatetime.

regts.start <- ISOdatetime(year.start, mo.start, day.start, hour=0, min=0, sec=0, tz="GMT")
regts.end <- ISOdatetime(year.end, mo.end, day.end, hour=0, min=0,
sec=0, tz="GMT")

Then, I generate a zoo time series from the data.

zts <- zooreg(mend.dat$Value, start = regts.start, end = regts.end, frequency = 1, deltat = 86400)

I now want to subset using window.

window(zts, start=as.Date("2000-01-01"), end=as.Date("2000-01-02"))

This results in the following error message.

Data:
factor(0)
1496 Levels: 100 1000 10000 101 1010 10100 102 1020 103 1030 104 1040 105 1050 10500 106 1060 107 1070 108 1080 ... Eqp

Index:
character(0)
Warning messages:
1: In which(in.index & all.indexes >= start & all.indexes <= end) :   Incompatible methods ("Ops.POSIXt", "Ops.Date") for ">=" 2: In which(in.index & all.indexes >= start & all.indexes <= end) :   Incompatible methods ("Ops.POSIXt", "Ops.Date") for "<="

Why is this happening?

Thanks for your help.

Katrina Bennett



R-help_at_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. Received on Thu 14 Apr 2011 - 06:31:17 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 14 Apr 2011 - 21:00:31 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive