title: Row/column counter in 'apply' functions
body: <p>What if one wants to <code>apply</code> a functon i.e. to each row of a matrix, but also wants to use as an argument for this function the number of that row. As an example, suppose you wanted to get the n-th root of the numbers in each row of a matrix, where n is the row number. Is there another way (using <code>apply</code> only) than column-binding the row numbers to the initial matrix, like this?</p>
  
  <pre><code>test &lt;- data.frame(x=c(26,21,20),y=c(34,29,28))
  
  t(apply(cbind(as.numeric(rownames(test)),test),1,function(x) x[2:3]^(1/x[1])))
  </code></pre>
  
  <p>P.S. Actually if <em>test</em> was really a matrix :  <code>test &lt;- matrix(c(26,21,20,34,29,28),nrow=3)</code>  , rownames(test) doesn't help :(
  Thank you.</p>