title: Conditional replacement of values in R
body: <p>I have a question in R. I have a dataset whose cells I would like to change based on the value of the column next to each other</p>
  <pre><code>Data &lt;- tibble(a = 1:5,  
  b = c(&quot;G&quot;,&quot;H&quot;,&quot;I&quot;,&quot;J&quot;,&quot;K&quot;),
  c = c(&quot;G&quot;,&quot;H&quot;,&quot;J&quot;,&quot;I&quot;,&quot;J&quot;))
  </code></pre>
  <p>I would like to change the chr. to NA if b and c have the same chr.</p>
  <p>Desired output</p>
  <pre><code>Data &lt;- tibble(a = 1:5,  
      b = c(&quot;NA&quot;,&quot;NA&quot;,&quot;I&quot;,&quot;J&quot;,&quot;K&quot;),
      c = c(&quot;NA&quot;,&quot;NA&quot;,&quot;J&quot;,&quot;I&quot;,&quot;J&quot;))
  </code></pre>
  <p>Thanks a lot for your help in advance.</p>