title: dplyr : filter a sequence of rows (in one column)
body: <p>A dummy data frame:</p>
  
  <pre><code>id_family&lt;- c(1, 1, 2, 2, 3, 3)
  people&lt;- c("male", "female", "male", "female", "male", "children") 
  
  dataset &lt;- data.frame(id_family, people)  
  dataset
  </code></pre>
  
  <p>My results :</p>
  
  <pre><code>id_family   people
  1           male            
  1           female          
  2           male            
  2           female          
  3           male            
  3           children
  </code></pre>
  
  <p>What I want: filtering rows based on the "male and female" sequence</p>
  
  <p>Expected result: filtering families 1 and 2 </p>
  
  <pre><code>id_family   people
  1           male            
  1           female          
  2           male            
  2           female          
  </code></pre>
  
  <p>I tried to use lag/lead dplyr's functions without success: </p>
  
  <pre><code> dataset2 &lt;- dataset %&gt;%
      filter(people=="male", lead(people)=="female")
  </code></pre>