Re: [R] zoo, zooreg, & ISOdatetime

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Sat 27 Aug 2005 - 19:28:18 EST

On Fri, 26 Aug 2005, David James wrote:

> 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).

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"

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Aug 27 19:32:59 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 16:00:45 EST