title: Convert daily to weekly/monthly data with R
body: <p>I have daily prices series over a wide range of products; I want to convert to a new dataframe with weekly or monthly data.</p>
  <p><img src="https://i.stack.imgur.com/6k5Zl.png" alt="enter image description here" /></p>
  <p>I first used xts in order to apply the to.weekly function...which works only for OHLC format.
  I am sure there may exist a function similar to to.weekly but for dataframe where the format is not OHLC.</p>
  <p>There a different posts already related to this as the following:
  <a href="https://stackoverflow.com/questions/12019164/does-rollapply-allow-an-array-of-results-from-call-to-function">Does rollapply() allow an array of results from call to function?</a>
  or <a href="https://stackoverflow.com/questions/15102327/averaging-daily-data-into-weekly-data?rq=1">Averaging daily data into weekly data</a></p>
  <p>I eventually used:</p>
  <pre><code>length(bra)
  </code></pre>
  <blockquote>
  <p>[1] 2416</p>
  </blockquote>
  <pre><code>test&lt;-bra[seq(1,2416,7),]
  </code></pre>
  <p>Would there be a more efficient approach?
  Thanks.</p>