title: Using an If function, how do I change string of text in dataframe to another string?
body: <p>using the following dataset</p>
  <pre><code> structure(list(...1 = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 
  1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 
  9, 10, 11, 12), V1 = c(&quot;overstress&quot;, &quot;flicker&quot;, &quot;lotteri&quot;, &quot;life&quot;, 
  &quot;charg&quot;, &quot;capac&quot;, &quot;health&quot;, &quot;drain&quot;, &quot;degrad&quot;, &quot;protector&quot;, &quot;bright&quot;, 
  &quot;use&quot;, &quot;overstress&quot;, &quot;flicker&quot;, &quot;lotteri&quot;, &quot;life&quot;, &quot;charg&quot;, &quot;capac&quot;, 
  &quot;health&quot;, &quot;drain&quot;, &quot;degrad&quot;, &quot;protector&quot;, &quot;bright&quot;, &quot;use&quot;, &quot;overstress&quot;, 
  &quot;flicker&quot;, &quot;lotteri&quot;, &quot;life&quot;, &quot;charg&quot;, &quot;capac&quot;, &quot;health&quot;, &quot;drain&quot;, 
  &quot;degrad&quot;, &quot;protector&quot;, &quot;bright&quot;, &quot;use&quot;), term = c(&quot;corr1&quot;, &quot;corr1&quot;, 
  &quot;corr1&quot;, &quot;corr1&quot;, &quot;corr1&quot;, &quot;corr1&quot;, &quot;corr1&quot;, &quot;corr1&quot;, &quot;corr1&quot;, 
  &quot;corr1&quot;, &quot;corr1&quot;, &quot;corr1&quot;, &quot;corr2&quot;, &quot;corr2&quot;, &quot;corr2&quot;, &quot;corr2&quot;, 
  &quot;corr2&quot;, &quot;corr2&quot;, &quot;corr2&quot;, &quot;corr2&quot;, &quot;corr2&quot;, &quot;corr2&quot;, &quot;corr2&quot;, 
  &quot;corr2&quot;, &quot;corr3&quot;, &quot;corr3&quot;, &quot;corr3&quot;, &quot;corr3&quot;, &quot;corr3&quot;, &quot;corr3&quot;, 
  &quot;corr3&quot;, &quot;corr3&quot;, &quot;corr3&quot;, &quot;corr3&quot;, &quot;corr3&quot;, &quot;corr3&quot;), correlation = c(0.5, 
  0.43, 0.42, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.53, 
  0.29, 0.25, 0.25, 0.23, 0.2, NA, NA, NA, NA, NA, NA, NA, NA, 
  NA, NA, NA, NA, 0.45, 0.16, 0.15)), row.names = c(NA, -36L), class = c(&quot;tbl_df&quot;, 
  &quot;tbl&quot;, &quot;data.frame&quot;))
  </code></pre>
  <p>I am looking to change if the word is corr1, corr2 or corr3, to toil1,toil2 or toil3. I tried the following code, but only receive the following error term:</p>
  <pre><code>three_terms_corrs_gathered$term &lt;- if
  (three_terms_corrs_gathered$term  == &quot;corr1&quot;){toil1} else if
  (three_terms_corrs_gathered$term  == &quot;corr2&quot;){toil2} else
  {toil3}
  </code></pre>
  <p>Warning message:</p>
  <blockquote>
  <p>In if (three_terms_corrs_gathered$term == &quot;corr1&quot;) { :   the condition
  has length &gt; 1 and only the first element will be used.  So it only
  changes to the first condition. What am I doing wrong?</p>
  </blockquote>