title: Is there a selective replace function? Should it be done using a If statement or For loop?
body: <p>I am relatively new to R. I need some help with more of a find and replace function but it is a bit more selective.</p>
  <p>The example datasets I am using can be derived through:</p>
  <pre><code>name_1 &lt;- c(&quot;Madeline&quot;,&quot;Maximillian&quot;,&quot;Maxon&quot;,&quot;Mad&quot;,&quot;Marvin&quot;)
  value &lt;- c(2.3,3.4,7.5,1.9,16.2)
  scoreboard_table &lt;- data.frame(name_1,value)
  
  name_2 &lt;- c(&quot;Madeline&quot;,&quot;Maximillian&quot;,&quot;Maxon&quot;,&quot;Mad&quot;)
  nickname_1 &lt;- c(&quot;Mad&quot;,&quot;Max&quot;,&quot;M&quot;,&quot;N/A&quot;)
  nickname_2 &lt;- c(&quot;Madine&quot;,&quot;Maxim&quot;,&quot;N/A&quot;,&quot;N/A&quot;)
  nickname_table &lt;- data.frame(name_2,nickname_1,nickname_2)
  </code></pre>
  <p>I want to replace the name of the scoreboard table with the second nickname. In that case, it would result in scoreboard_table to turn into:</p>
  <pre><code>name_1 &lt;- c(&quot;Madine&quot;,&quot;Maxim&quot;,&quot;Maxon&quot;,&quot;Mad&quot;,&quot;Marvin&quot;)
  value &lt;- c(2.3,3.4,7.5,1.9,16.2)
  scoreboard_table &lt;- data.frame(name_1,value)
  </code></pre>
  <p>I am sure if doing a for loop would be easier or making an if, else statement. How should I go about this overall?</p>
  <p>Thank you for the help in advance. It is really appreciated.</p>