vwl-mailingliste at gmx.de
2008-Sep-22 14:13 UTC
[R] zoo: hourly values (local time) not unique
Hi! I've got a time series as a zoo object which contains hourly values. My problem is that these values occur in every "real" hour with regard to daylight savings time. I.e. the last sunday in march, i'll have 23values whereas the last sunday in october contains 25 values instead of 24. Thus if I try to aggregate the data using for example tapply (e.g. to get a monthly mean), I get the error "some methods for "zoo" objects do not work if the index entries in 'order.by' are not unique" Any idea how I can solve this without having to remove/add an hour each year manually? Or, as I'm quite new to R, how I could easily manipulate my data so that the "missing" hour is introduced and the "double" hour is cut from the data (and the index)? I'd really appreciate your help! Thanks in advance, Arne --
See question #1 in the zoo faq: library(zoo) vignette("zoo-faq") Also in the upcoming zoo 1.6-0, not yet on CRAN but in the development version at R-Forge found here: http://r-forge.r-project.org/projects/zoo/ there are a set of make.unique functions and a make.unique= argument in read.zoo which will provide additional capabilities for uniquifying series. On Mon, Sep 22, 2008 at 10:13 AM, <vwl-mailingliste at gmx.de> wrote:> Hi! > > I've got a time series as a zoo object which contains hourly values. My problem is that these values occur in every "real" hour with regard to daylight savings time. I.e. the last sunday in march, i'll have 23values whereas the last sunday in october contains 25 values instead of 24. > Thus if I try to aggregate the data using for example tapply (e.g. to get a monthly mean), I get the error > > "some methods for "zoo" objects do not work if the index entries in 'order.by' are not unique" > > Any idea how I can solve this without having to remove/add an hour each year manually? Or, as I'm quite new to R, how I could easily manipulate my data so that the "missing" hour is introduced and the "double" hour is cut from the data (and the index)? > > I'd really appreciate your help! Thanks in advance, > Arne > -- > > ______________________________________________ > 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. >