title: Rename first and second occurence of the same specific value in a column iteratively
body: <p>In this dataframe <code>df</code> of 1 column <code>X</code> the value <code>a</code> is occuring multiple times:</p>
  <p>dataframe:</p>
  <pre><code>df &lt;- structure(list(col = c(&quot;&lt;NA&gt;&quot;, &quot;&lt;NA&gt;&quot;, &quot;a&quot;, &quot;&lt;NA&gt;&quot;, &quot;&lt;NA&gt;&quot;, &quot;&lt;NA&gt;&quot;, 
                         &quot;a&quot;, &quot;&lt;NA&gt;&quot;, &quot;&lt;NA&gt;&quot;, &quot;&lt;NA&gt;&quot;, &quot;&lt;NA&gt;&quot;, &quot;&lt;NA&gt;&quot;, &quot;a&quot;, &quot;&lt;NA&gt;&quot;, &quot;&lt;NA&gt;&quot;, 
                         &quot;a&quot;, &quot;&lt;NA&gt;&quot;, &quot;&lt;NA&gt;&quot;, &quot;a&quot;, &quot;&lt;NA&gt;&quot;, &quot;&lt;NA&gt;&quot;, &quot;a&quot;, &quot;&lt;NA&gt;&quot;)), class = &quot;data.frame&quot;, row.names = c(NA, 
                                                                                                                      -23L))
  </code></pre>
  <p>I would like to rename the first <code>a</code> as <code>start</code> and the second <code>a</code> as <code>end</code> and the next <code>a</code> again as <code>start</code> and the next <code>a</code> as <code>end</code> and so on....</p>
  <p>desired output:</p>
  <pre><code>df1 &lt;- structure(list(col = c(&quot;&lt;NA&gt;&quot;, &quot;&lt;NA&gt;&quot;, &quot;start&quot;, &quot;&lt;NA&gt;&quot;, &quot;&lt;NA&gt;&quot;, 
                         &quot;&lt;NA&gt;&quot;, &quot;end&quot;, &quot;&lt;NA&gt;&quot;, &quot;&lt;NA&gt;&quot;, &quot;&lt;NA&gt;&quot;, &quot;&lt;NA&gt;&quot;, &quot;&lt;NA&gt;&quot;, &quot;start&quot;, 
                         &quot;&lt;NA&gt;&quot;, &quot;&lt;NA&gt;&quot;, &quot;end&quot;, &quot;&lt;NA&gt;&quot;, &quot;&lt;NA&gt;&quot;, &quot;start&quot;, &quot;&lt;NA&gt;&quot;, &quot;&lt;NA&gt;&quot;, 
                         &quot;end&quot;, &quot;&lt;NA&gt;&quot;)), class = &quot;data.frame&quot;, row.names = c(NA, -23L
                         ))
  </code></pre>
  <p>Many thanks!!!</p>