title: How to subset a dataframe with multiple conditions involving days and values for two factor variables
body: <p>I have a dataset with the structure shown below. </p>
  
  <pre><code>dat &lt;- data.frame(
     event = c("A", "A", "A", "B", "B", "B", "B", "C", "C", "C"), 
     place =c("p1", "p1", "p2", "p3", "p3", "p3", "p4","p4","p4", "p5"), 
     day = c("May 1","May 2","May 3", "May 4", "May 5", "May 6", "May 7", "May 8", 
             "May 9", "May 1"),     
     visits = c(2,1,4,1,2,4,8,2,3,1))
  </code></pre>
  
  <p>I would like to identify, for each event, the place that have the highest value of visits for 2 (or at least 2) different days.</p>
  
  <p>Result I want:</p>
  
  <pre><code>event place visits
  A     p1     3
  B     p3     7
  C     p4     5
  </code></pre>