title: Using row-wise column indices in a vector to extract values from data frame
body: <p>Using vector of column positional indexes such as:</p>
  <pre><code>&gt; i &lt;- c(3,1,2)
  </code></pre>
  <p>How can I use the index to extract the 3rd value from the first row of a data frame, the 1st value from the second row, the 2nd value from the third row, etc.</p>
  <p>For example, using the above index and:</p>
  <pre><code>&gt; dframe &lt;- data.frame(x=c(&quot;a&quot;,&quot;b&quot;,&quot;c&quot;), y=c(&quot;d&quot;,&quot;e&quot;,&quot;f&quot;), z=c(&quot;g&quot;,&quot;h&quot;,&quot;i&quot;))
  
  &gt; dframe  
    x y z  
  1 a d g  
  2 b e h  
  3 c f i  
  </code></pre>
  <p>I would like to return:</p>
  <pre><code>&gt; [1] &quot;g&quot;, &quot;b&quot;, &quot;f&quot;
  </code></pre>