title: Calculate row specific based on min
body: <p>My data looks like this</p>
  
  <pre><code>df &lt;- data.frame(x = c(3, 5, 4, 4, 3, 2),
                   y = c(.9, .8, 1, 1.2, .5, .1))
  </code></pre>
  
  <p>I am trying to multiply each x value by either y or 1, depending on which has the least value.  </p>
  
  <pre><code>df$z &lt;- df$x * min(df$y, 1)
  </code></pre>
  
  <p>The problem is it is taking the min of the whole column, so it is multiplying every x by 0.1.</p>
  
  <p>Instead, I need x multiplied by .9, .8, 1, 1, .5, .1...</p>