title: R indirect reference in data frame
body: <p>I would like to refer to values in a data frame column with the row index being dependent on the value of another column.</p>
  
  <p>Example:</p>
  
  <pre><code>value   lag laggedValue
  1        1      2
  2        2      4
  3        3      6
  4        2      6
  5        1      6
  6        3      9
  7        3      10
  8        1      9
  9        1      10
  10       2  
  </code></pre>
  
  <p>In Excel I use this formula in column "<code>laggedValue</code>":</p>
  
  <pre><code>=INDIRECT("B"&amp;(ROW(B2)+C2))
  </code></pre>
  
  <p>How can I do this in an R data frame?</p>
  
  <p>Thanks!</p>