title: How do I count the number of times a character "x" is reported in column "ID", and report a weight measure for each row?
body: <pre><code>&gt; head(mini)
     ID        sequence class     
  1:   3930271        0  A63B   
  2:   3930272        0  A47D     
  3:   3930272        1  Y10T 
  4:   3930273        0  A61G    
  5:   3930273        1  A61G    
  6:   3930274        0  B63B   
  </code></pre>
  
  <p>I would like to compute the weight of each class to the respective ID. Therefore, I'd need a count of the number of classes per ID and then assign a simple value weight to each class. For example, ID 3930272 has two classes and I would like to have a new column that reports 0.5 as the class weight on ID. 
  Visualization here below: </p>
  
  <pre><code>   ID        sequence class  weight  
  1:   3930271        0  A63B       1
  2:   3930272        0  A47D     0.5
  3:   3930272        1  Y10T     0.5
  4:   3930273        0  A61G     0.5
  5:   3930273        1  A61G     0.5
  6:   3930274        0  B63B       1
  </code></pre>
  
  <p>Please note that ID 3930273 has two identical classes, but I still want to see a weight of 0.5 for that class. Thank you!</p>