title: how to use which.min in subset of data frame?
body: <p>I have this data frame</p>
  
  <pre><code>df &lt;- structure(list(a = 1:20, b = c(4, 2, 5, 6, 2, 4, 7, 4, 9, 7, 6, 1, 1, 5, 2, 1, 9, 8, 6, 3), c = c(340, 200, 130, 730, 710, 340, 200, 130, 730, 710, 340, 200, 130, 730, 710, 340, 200, 130, 730, 710)), .Names = c("a", "b", "c"), row.names = c(NA, -20L), class = "data.frame")
  </code></pre>
  
  <p>My desired output is the index of </p>
  
  <pre><code>which.min(df[1:V,3])
  </code></pre>
  
  <p>where V is a row number, e.g.</p>
  
  <pre><code>V &lt;- 10
  </code></pre>
  
  <p>However, I'd like the following restriction:</p>
  
  <pre><code>df[which(df$a&lt;=df$b[V]),]
  </code></pre>
  
  <p>I think I've tried any combinition to bring these together (e.g. with <code>with()</code>) but I just cannot get it to work. What do I have to do?</p>