title: Assign a unique ID while a condition is FALSE in r
body: <p>I need to assign unique IDs, however, there is not identifying variables other than when size decreases. I have created a vector of TRUE/FALSE statements and I want to assign an ID to each row while the statement is FALSE. Every time a TRUE statement is then passed, I want to assign a new ID to the rows and this ID to continue while the statement is FALSE.</p>
  
  <p>A sample of my dataset: </p>
  
  <pre><code>     Size    index
  1    8.70    FALSE
  2    9.40    FALSE
  3   10.00    FALSE
  4   10.50    FALSE
  5   11.00    FALSE
  6    1.60    TRUE
  7    2.20    FALSE
  8    2.60    FALSE
  9    3.30    FALSE
  10   3.70    FALSE
  11   1.10    TRUE
  12   2.40    FALSE
  13   2.80    FALSE
  14   3.40    FALSE
  15   4.90    FALSE
  16   6.20    FALSE
  17   1.90    TRUE
  18   2.20    FALSE
  19   3.30    FALSE
  20   4.80    FALSE
  </code></pre>
  
  <p>I have tried using the following code</p>
  
  <pre><code>x$index[1] &lt;- FALSE
  RandomID &lt;- sample(100:999, size = 1000, replace = TRUE)
  for(i in 1:len){
    int &lt;- sample(RandomID,1,replace = FALSE)
    if(x$index[i] == FALSE) {
      print(int)
    }else{break}
  }
  </code></pre>