title: Subtracting or adding to column value based on its value in R
body: <p>I Have a dataframe named <code>mydata</code>. Here's a sample of the relevant column:</p>
  
  <pre><code>Accuracy.Percentage
  100.00
  127.00
  60.00
  175.00
  52.00
  </code></pre>
  
  <p>Now, what I want to accomplish is the following: when the value of a row is &lt; 100, I want change its value with <code>100 - mydata$Accuracy.Percentage</code>, when the value is > 100, I want to change its value with <code>mydata$Accuracy.Percentage - 100</code>. I have tried something like</p>
  
  <pre><code>result &lt;- if(mydata$Accuracy.Percentage &lt; 100) { 
    mutate(result$Accuracy.Percentage = 100 - result$Accuracy.Percentage) 
    } 
  else mutate(result$Accuracy.Percentage = result$Accuracy.Percentage - 100)
  </code></pre>
  
  <p>But I can't seem to get it to work, although there probably is a simple way to accomplish this. Thanks in advance, I hope I have been clear enough and formulated my question in a understandable manner!</p>