[R] timestamp shifted by hour(s) while mering zoo objects

Keith kigiokli at gmail.com
Sun Mar 7 18:20:31 CET 2010


Dear R-users,

I have two regular hourly time series data which were recorded in time 
zone GMT+1, and now I would like to merge them together for further 
analyses. Here I used zoo and merge.zoo for my purposes and everything 
worked fine except the timestamp shifted 2 hours after merging which 
bugs me a little bit. Here is the example:

data01
00:00:00 01.01.2007, 8.0250
01:00:00 01.01.2007, 8.0167
02:00:00 01.01.2007, 10.0917
03:00:00 01.01.2007, 8.6750
04:00:00 01.01.2007, 6.3250

data02
00:00:00 01.01.2007, 257.58
01:00:00 01.01.2007, 239.92
02:00:00 01.01.2007, 234.00
03:00:00 01.01.2007, 220.00
04:00:00 01.01.2007, 206.92

which are both read into zoo object, data01 and data02, separately by 
setting tz = "GMT+1". However, while merging function is operated, the 
result is

merge.zoo(data01, data02)
                      data01 data02
2007-01-01 02:00:00  8.0250 257.58
2007-01-01 03:00:00  8.0167 239.92
2007-01-01 04:00:00 10.0917 234.00
2007-01-01 05:00:00  8.6750 220.00
2007-01-01 06:00:00  6.3250 206.92

which is 2 hours shifted comparing to the original data. I am wondering 
if it's the problem of tz parameter. Hence, I re-read the data by 
setting tz = "GMT", and the merging result is

merge.zoo(data01, data02)
                      data01 data02
2007-01-01 01:00:00  8.0250 257.58
2007-01-01 02:00:00  8.0167 239.92
2007-01-01 03:00:00 10.0917 234.00
2007-01-01 04:00:00  8.6750 220.00
2007-01-01 05:00:00  6.3250 206.92

which is 1 hour shifted. I only noticed this but don't know why and how 
to fix it. Does anyone have idea about this issue?

Best regards,
Keith



More information about the R-help mailing list