title: Grouping first few rows with positive value followed by another group with negative values and so on using R
body: <p>I have a dataframe looks like this:</p>
  <pre><code>name       strand
  
  thrL       1
  
  thrA       1
  
  thrB       1
  
  yaaA       -1
  
  yaaJ       -1
  
  talB       1
  
  mog        1
  </code></pre>
  <p>I would like to group first few positive values into a group, negative values a group and next postive numbers as another group which look like this:</p>
  <pre><code>name       strand     directon
  
  thrL       1           1
  
  thrA       1           1
  
  thrB       1           1
  
  yaaA       -1          2
  
  yaaJ       -1          2
  
  talB       1           3
  
  mog        1           3
  </code></pre>
  <p>I am thinking to use dplyr but I need some help with the code using R. Thank you so much.</p>