Skip to content

zoo, zooreg, & ISOdatetime

3 messages · David James, Gabor Grothendieck, Brian Ripley

#
I create a zooreg object that runs from Jan-1-2002 0:00 to Jun-1-2005  
0:00...

regts.start = ISOdatetime(2002, 1, 1, hour=0, min=0, sec=0, tz="")
regts.end = ISOdatetime(2005, 6, 1, hour=0, min=0, sec=0, tz="")
regts.zoo <- zooreg( NA, regts.start, regts.end, deltat=3600 )

Upon inspection:
 > regts.zoo[1:3]
2002-01-01 00:00:00 2002-01-01 01:00:00 2002-01-01 02:00:00
                  NA                  NA                  NA

 > regts.zoo[29926:29928]
2005-05-31 22:00:00 2005-05-31 23:00:00 2005-06-01 00:00:00
                  NA                  NA                  NA

However:
 > summary(regts.zoo)
Error in "row.names<-.data.frame"(`*tmp*`, value = c("2002-01-01  
00:00:00",  :
     duplicate 'row.names' are not allowed

I don't understand why it claims that there are duplicate row.names.   
Any advice?

I probably could use the aggregate function to clean this up, but I  
don't see why it should be needed (provided that I do things properly  
in the first place).

Thanks,
David
#
On 8/26/05, David James <djames at frontierassoc.com> wrote:
Because you are using tz = "" and when the time falls back in fall 2am is 1am 
so you wind up having two 1am's which is not allowed.   The times
themselves are
ok but the names are duplicated which is not allowed either.  Thanks for
finding this problem.
1. Use tz = "GMT" rather than tz = "" since GMT has no daylight savings time 
and won't result in duplicate names.
2. As advised last time use chron if you don't need time zones.

3. Read the R News 4/1 article I previously recommended, which has the
same advice as #2 plus a lot more info on dates and times.

4. If you are using time zones and do need POSIXct and tz = "" then let me know 
privately and I will send you the devel version of zoo where I just fixed it.
Yes.  It should not be needed.
#
On Fri, 26 Aug 2005, David James wrote:

            
This is a bug in the zoo package, so please raise it with the maintainer.
Hint: incrementing through a DST change in hourly intervals will result in 
duplicate time labels, as in

[24811] "2004-10-30 19:00:00 BST" "2004-10-30 20:00:00 BST"
[24813] "2004-10-30 21:00:00 BST" "2004-10-30 22:00:00 BST"
[24815] "2004-10-30 23:00:00 BST" "2004-10-31 00:00:00 BST"
[24817] "2004-10-31 01:00:00 BST" "2004-10-31 01:00:00 GMT"
[24819] "2004-10-31 02:00:00 GMT" "2004-10-31 03:00:00 GMT"
[24821] "2004-10-31 04:00:00 GMT" "2004-10-31 05:00:00 GMT"
[24823] "2004-10-31 06:00:00 GMT" "2004-10-31 07:00:00 GMT"
[24825] "2004-10-31 08:00:00 GMT" "2004-10-31 09:00:00 GMT"