I have a time series x:
dput(x)
structure(c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28.8, 0, 0,
0, 0, 0, 0, 0, 0), index = structure(c(1193524740, 1193525340,
1193525940, 1193526540, 1193527140, 1193527740, 1193528340, 1193528940,
1193529540, 1193530140, 1193530740, 1193531340, 1193531940, 1193532540,
1193533140, 1193533740, 1193534340, 1193534940, 1193535540, 1193536140,
1193536740, 1193537340), class = c("POSIXct", "POSIXt")), class = "zoo")
I aggregate to 1 hour
as.xts(aggregate(x, align.time(index(x), 60*60)))
[,1]
2007-10-28 00:00:00 0.0
2007-10-28 01:00:00 0.0
2007-10-28 01:00:00 28.8
2007-10-28 02:00:00 0.0
2007-10-28 03:00:00 0.0
As you can see, I get "2007-10-28 01:00:00" duplicated.
I wonder whether this is a bug or I'm doing something wrong?
I have a time series x:
dput(x)
structure(c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28.8, 0, 0,
0, 0, 0, 0, 0, 0), index = structure(c(1193524740, 1193525340,
1193525940, 1193526540, 1193527140, 1193527740, 1193528340, 1193528940,
1193529540, 1193530140, 1193530740, 1193531340, 1193531940, 1193532540,
1193533140, 1193533740, 1193534340, 1193534940, 1193535540, 1193536140,
1193536740, 1193537340), class = c("POSIXct", "POSIXt")), class = "zoo")
I aggregate to 1 hour
as.xts(aggregate(x, align.time(index(x), 60*60)))
[,1]
2007-10-28 00:00:00 0.0
2007-10-28 01:00:00 0.0
2007-10-28 01:00:00 28.8
2007-10-28 02:00:00 0.0
2007-10-28 03:00:00 0.0
As you can see, I get "2007-10-28 01:00:00" duplicated.
I wonder whether this is a bug or I'm doing something wrong?
0 commentaires:
Enregistrer un commentaire