title: Divide One Column by Another with Time Lag
body: <p>I have a table storing stock prices, i.e. stock ID, date, open price, close price. I want to select a table within a certain date range, and also comes with the price returns from yesterday's close to today's open. </p>
  
  <p>Basically I need to add a column, where the value for ith row equals Open(i)/Close(i-1), how can I do it?</p>
  
  <p>I know if easy to calculate Open(i)/Close(i), but how to divide with a value from a different row? The length of the new column will be 1 unit less than the length of other columns, is it possible to put an 'NA' in order to match the length? </p>