title: Grouping categorical data with a factor (yes/no) for each observation
body: <p>Iam working on a project in R but can't figure out how to create grouped data based on the categorical variable (Occuptation with 10 factors) and Died( being a yes/no factor variable). </p>
  
  <p>Ive looked at numerous articles but everytime I try to count the number of "yes" and "no" of a single column(Died) i get a dimension error</p>
  
  <pre><code>'data.frame':   2571 obs. of  4 variables:
   $ Occupation: Factor w/ 10 levels "business/service",..: 3 2 2 2 2 2 2 2 2 5 ...
   $ Education : Factor w/ 5 levels "iliterate","primary",..: 3 2 2 2 3 1 1 3 2 3 ...
   $ Age       : int  39 83 60 73 51 62 90 54 66 30 ...
   $ Died      : Factor w/ 2 levels "no","yes": 1 2 2 2 1 2 2 1 2 1 ...
  </code></pre>
  
  <p>this is the summary of my data. SO looking to group Each 10 of the occupation factors with the number of people died.</p>
  
  <p>This was the code I was trying is:</p>
  
  <pre><code>dperoccu &lt;- summarise(occu, count = n(), deaths = count(SuicideChina$Died, "yes"))
  </code></pre>
  
  <p>but produced the follwing error:</p>
  
  <blockquote>
  <pre><code>Error in UseMethod("group_by_") : 
    no applicable method for 'group_by_' applied to an object of class "factor"
  </code></pre>
  </blockquote>