title: Reorganizing a Vector with words in R
body: <p>This is my vector:</p>
  
  <pre><code>myvector&lt;-c("yes","yes","no","yes","yes","yes","No","No","No","yes","yes","No","No","No","yes","No","No","No","yes","yes")
  </code></pre>
  
  <p>I need to do the following: </p>
  
  <p>if it has the word "no" repeatedly it deletes the first one and replace by "yes" the o others. He does it <strong>backwards</strong>. If the word "No" appears only once it doesnt do nothing.</p>
  
  <p>The final vector should be like this:</p>
  
  <pre><code>myfinalvector&lt;-c("yes","yes","no","yes","yes","yes","yes","yes","No","yes","yes","yes","yes","No","yes","yes","yes","No","yes","yes")
  </code></pre>
  
  <p>Any help guys?</p>