title: Conditional count based on list of repeated IDs
body: <p>I cannot seem to get this to work or find the answer. 
  I have a data frame like this: </p>
  
  <pre><code>PatientID &lt;- c('1', "1", "1","1", "2","2","2","2","3")
  hospital.time &lt;- c(1,1,1,2,1,2,3,4,1)
  fever &lt;- c(1,1,NA,0,1,NA,1,1,NA)
  ventilator&lt;-c(1,0,1,1,0,1,0,1,NA)
  df &lt;- data.frame(PatientID, hospital.time, fever,ventilator)
  </code></pre>
  
  <p>Each patient have several measurements so the ID is repeated for each measurement.
  I would like to count how many patients in hour 1 have fever and on ventilator, how many patients have only fever, how many only on ventilator, the same for hour 2, hour 3 etc.</p>
  
  <p>I have tried using boolean and dplyr based on PatientID, but no luck. 
  Will I have to put this in a for loop to make it work?</p>
  
  <p>Hope you can help.</p>