title: Finding Daily Returns in R for multiple worksheets in the same workbook and merge them?
body: <p>Hi i currently have 70 sheets under the same excel workbook and i am trying to find daily returns based on the data and then merge all 70 sheets into one data frame. All of the 70 sheets contain Date and Open price. Here is my code so far for the software R</p>
  
  <pre><code>require(XLConnect)
  wb &lt;- loadWorkbook(system.file("crypto.xlsx", package = "XLConnect"))
  crypto = readWorksheet(wb, sheet = getSheets(wb),startRow=1,endRow = 20, endCol=2)
  </code></pre>
  
  <p>I want to find returns of each sheet and then merge all 70 into one data frame. However the time period is different in all of these sheets and i cant find a way to merge them. In the Final dataframe i want the variables <code>Date, Price1, Dailyreturn1, Price2, DailyReturn2 ......... Price70, DailyReturn70</code> Any help would be appreciated with returns and merge. </p>
  
  <p>Here is how my data looks like with a lot more rows and the data format is the same for all 70 sheets.</p>
  
  <pre><code>Date        Open        High    Low    Close   Market Cap
  28-Apr-13   135.3       135.98  132.1  134.21  1,500,520,000
  29-Apr-13   134.44      147.49  134    144.54  1,491,160,000
  30-Apr-13   144         146.93  134.05 139     1,597,780,000
  1-May-13    139         139.89  107.72 116.99  1,542,820,000
  </code></pre>
  
  <p>and i want the end result to look somewhat like this with all 70 sheets combined into one. DR is for Daily return</p>
  
  <pre><code>Date Open1 DR1 Open2 DR2 Open3 DR3............Open70 DR70
  </code></pre>