title: Add a column for rank, then ranking by group
body: <p>I have managed to add a column for ranking for my data frame</p>
  
  <pre><code>lowest.mortality.upper&lt;-nrow(lowest.mortality)
  ## Add a ranking column
  lowest.mortality$ranking&lt;-c(1:lowest.mortality.upper)
  </code></pre>
  
  <p>However now I have to rank a bigger dataset based on another column state. So it would read</p>
  
  <pre><code>AK 1
  AK 2
  TX 1
  TX 2
  TX 3
  </code></pre>
  
  <p>I could use a for loop but thats so 1980's. I'm sure that subset or lapply should work but I can't figure out how</p>
  
  <p>Thanks</p>