title: Conditionally replace values in one column/row with values from another row/column using dplyr
body: <p>I am trying to conditionally replace values in one column/row with values from another column/row using <code>dplyr</code>.</p>
  <p>Here is a sample of the data:</p>
  <pre><code>  id          colours tagl  TAGLFT grid
    &lt;fct&gt;       &lt;chr&gt;   &lt;chr&gt; &lt;chr&gt; &lt;chr&gt;
    6391        B*/Y*   45820 45820  KL 
    6391        B*/Y*   45820 46272  KL
    8443        B*/Y*   46272 46272  SU
  </code></pre>
  <p>I am able to successfully replace within rows using this code:</p>
  <pre><code>updated&lt;-df %&gt;%
      mutate(tagl=ifelse(!tagl==TAGLFT, TAGLFT, tagl))
  </code></pre>
  <p>I look for any rows where <code>tagl==TAGLFT</code> and then replace <code>tagl</code> values with <code>TAGLFT</code> values. Then, if that condition is true (i.e., replacement has occurred), I need to also replace the <code>id</code> column with the correct <code>id</code> (these values are found in different rows).</p>
  <p>Here is what I want:</p>
  <pre><code>  id          colours tagl  TAGLFT grid
    &lt;fct&gt;       &lt;chr&gt;   &lt;chr&gt; &lt;chr&gt; &lt;chr&gt;
    6391        B*/Y*   45820 45820  KL 
    8443        B*/Y*   46272 46272  KL
    8443        B*/Y*   46272 46272  SU
  </code></pre>
  <p>Any suggestions for how to work across rows? I work primarily in <code>dplyr</code>.</p>