title: Averaging time series in aggregate in apply.daily() in R
body: <p>I have several merged daily zoo timeseries (let's say the name of the merged set is 'test') that appear in the following format:</p>
  
  <pre><code>&gt;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
  </code></pre>
  
  <p>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:</p>
  
  <pre><code>ts &lt;- apply.daily(as.xts(test),mean)
  </code></pre>
  
  <p>which I had thought would give me the following output:</p>
  
  <pre><code>&gt;ts
  
                    X    
      2014-07-30    3.0     
      2014-07-31    3.3     
      2014-08-01    3.7    
  </code></pre>
  
  <p>However, it returns the same time series as before. I understand that this would be useful for <code>apply.weekly()</code> and <code>apply.monthly()</code>, 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.</p>
  
  <p>Many thanks</p>