title: error using apply.yearly inside xts package. How this works?
body: <p>I have been using ts objects for a while but not too much xts, so i was trying to calculate mean, sum, last, first... (FUN) for every year in economic time series. When i try it i have weird result.</p>
  
  <p>This is a quick example:
  Considering x and y like monthly series, for two consecutive years:</p>
  
  <pre><code>x &lt;- 1:12
  y &lt;- 1:12
  serie &lt;- c(x,y)
  </code></pre>
  
  <p>Then i create a ts object</p>
  
  <pre><code>serie &lt;- ts(serie,1990,,12)
  </code></pre>
  
  <p>now i convert it to xts object</p>
  
  <pre><code>library(xts)
  
  serie.xts &lt;- as.xts(serie)
  
  plot(serie.xts)
  </code></pre>
  
  <p>as far i see, the series is properly  created</p>
  
  <pre><code>serie.xts
  </code></pre>
  
  <p>The series looks ok</p>
  
  <pre><code>ene 1990    1
  feb 1990    2
  mar 1990    3
  abr 1990    4
  may 1990    5
  jun 1990    6
  jul 1990    7
  ago 1990    8
  sep 1990    9
  oct 1990   10
  nov 1990   11
  dic 1990   12
  ene 1991    1
  feb 1991    2
  mar 1991    3
  abr 1991    4
  may 1991    5
  jun 1991    6
  jul 1991    7
  ago 1991    8
  sep 1991    9
  oct 1991   10
  nov 1991   11
  dic 1991   12
  </code></pre>
  
  <p>Then comes my problem</p>
  
  <p>for example, i try to get the last value for every year, as far i know this is what this function do:</p>
  
  <pre><code>apply.yearly(serie.xts,FUN = "last")
  </code></pre>
  
  <p>but i get this:</p>
  
  <pre><code>ene 1990    1
  ene 1991    1
  dic 1991   12
  </code></pre>
  
  <p>I was expecting this:
  dic 1990   12
  dic 1991   12</p>
  
  <p>What am i doing wrong?
  Is this the way this function works?
  What this function do actually? </p>
  
  <p>i don't understand what is this result.
  Please help. And thanks for reading my question.</p>
  
  <p>R 3.3.3
  xts  0.9-7
  zoo 1.8-0</p>