title: R - How to get max() to return variable names instead of contents of the variables?
body: <p>I need to find the max value from a list of variables.  However, max() returns the contents of the variable instead of the variable name.  Is there a way to get the name instead of the content?</p>
  
  <p>Quick example code:</p>
  
  <pre><code>jan &lt;- 0
  feb &lt;- 0
  mar &lt;- 0
  
  #for testing purposes - just select a random month and add 10
  s1 &lt;- sample(1:3, 1)
  if (s1==1) {
    jan &lt;- jan + 10
  }
  if (s1==2) {
    feb &lt;- feb + 10
  }
  if (s1==3) {
    mar &lt;- mar + 10
  }
  
  final &lt;- max(jan, feb, mar)
  
  final
  </code></pre>
  
  <p>The result from that will always be 10.  That isn't helpful...  Is there a way to get the month/variable name returned instead? (ie "jan" instead of "10")</p>
  
  <p>Thank you!</p>