I have several merged daily zoo timeseries (let's say the name of the merged set is 'test') that appear in the following format:
>test
TS1 TS2 TS3
2014-07-30 2.0 3.0 4.0
2014-07-31 2.5 3.0 4.5
2014-08-01 3.0 3.0 5.0
I am wanting to aggregate/manipulate the time series in several ways. However, the simplest averaging or suming is escaping me. I tried the following:
ts <- apply.daily(as.xts(test),mean)
which I had thought would give me the following output:
>ts
X
2014-07-30 3.0
2014-07-31 3.3
2014-08-01 3.7
However, it returns the same time series as before. I understand that this would be useful for apply.weekly()
and apply.monthly()
, both of which I plan to use, but how can I adapt all these functions to wrap TS1, TS2, and TS3 into an overall average on the same basis, whilst maintaining the zoo/xts formatting.
Many thanks