I Have a dataframe named mydata
. Here's a sample of the relevant column:
Accuracy.Percentage
100.00
127.00
60.00
175.00
52.00
Now, what I want to accomplish is the following: when the value of a row is < 100, I want change its value with 100 - mydata$Accuracy.Percentage
, when the value is > 100, I want to change its value with mydata$Accuracy.Percentage - 100
. I have tried something like
result <- if(mydata$Accuracy.Percentage < 100) {
mutate(result$Accuracy.Percentage = 100 - result$Accuracy.Percentage)
}
else mutate(result$Accuracy.Percentage = result$Accuracy.Percentage - 100)
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!