title: Using values associated with unique values from a data frame
body: <p>I have a dataframe which resembles this- for example, 2 columns and multiple rows:</p>
  
  <p>A       2</p>
  
  <p>A     7</p>
  
  <p>B     1</p>
  
  <p>B     3</p>
  
  <p>B     6</p>
  
  <p>C     2</p>
  
  <p>I want to do some operations on the items in column two within each unique value of column 1.</p>
  
  <p>I have</p>
  
  <pre><code>  unique.values &lt;- sort(unique(mydata[,1])) 
  </code></pre>
  
  <p>This part works for getting each unique value, but I don't know how to associate each unique factor with the values that it takes in column two.  I need to be able to operate on each one entirely independently and want to be able to count rows etc.  Tried using grep, but couldn't make that work.</p>
  
  <p>Thank you for any help you can give!</p>