title: Group and summarize data with countif calculation
body: <p>Imagine having the following table called DT</p>
  
  <pre><code>ID    Path   Status
  AA    XXX    Completed
  AB    XXX    Completed
  AC    XXX    In progress
  AD    XYY    Completed
  AE    XYY    In progress
  </code></pre>
  
  <p>I want to group this table by Path and count (1) the amount of unique ID's and (2) the amount of unique ID's with the status 'Completed' (there are no duplicate ID's in the original table DT)</p>
  
  <p>I tried the following code:</p>
  
  <pre><code>DT_Grouped &lt;- DT %&gt;%
       group_by(Path) %&gt;%
       summarise(CountComplete = sum(DT$Status == "Completed"), Count=n())
  </code></pre>
  
  <p>This gives the following result:</p>
  
  <pre><code>Path   CountComplete   Count
  XXX    3               3
  XYY    3               2
  </code></pre>
  
  <p>CountComplete always gives the total amount of unique ID's with the status complete; not grouped by path. Which is logical as the calculation is referring to the original table and not the grouped dataset.</p>
  
  <p>How should I adapt the code in order for CountComplete to group according to Path?</p>
  
  <p>Thanks in advance for the help.</p>