title: Extracting and Printing multiple elements from different vectors in R
body: <p>I have a Data Frame with over 20 columns and am trying to create a new object which returns the maximum value of one vector and also returns the value in the same row of a different vector/variable. I have been reading through many many pages/sites on extracting elements but none that I have found seem relevant in my context. </p>
  
  <p>Here is the code I am using:</p>
  
  <pre><code>object &lt;- DF[which.max(DF[,ColNumber]),"VARNAME"]
  </code></pre>
  
  <p>What this line of code is doing is finding the row that corresponds to the maximum value for <code>ColNumber</code> and then printing ONLY the value of <code>VARNAME</code> for that row. How can I get R to return/print BOTH <code>VARNAME</code>'s value AND the max value?</p>