title: data.frame: find last index of a value in each row
body: <p>I have a <code>data.frame</code> like</p>
  
  <pre><code>  a b c d
  1 1 0 0 1
  2 1 1 0 0
  3 0 1 0 0
  4 1 0 1 0
  5 1 0 0 0
  </code></pre>
  
  <p>Which I generated using</p>
  
  <pre><code>df&lt;- data.frame(a=sample(0:1,5,replace=T),b=sample(0:1,5,replace=T),c=sample(0:1,5,replace=T),d=sample(0:1,5,replace=T))
  </code></pre>
  
  <p>How can I get the result as <code>4, 2, 2, 3, 1</code> if I pass 1 to that function depicting to find the last index of 1 in each row.</p>