I have no training in R and I would like to convert the probability of something to American Odds for sports betting. I found the equation online, but I don't know how to write it in R because it involves two levels (an if-statement I believe?). Here is what I need:
1) If implied probability is greater than .5 then I need R to run this formula:
Moneyline Odds = - (implied probability / (100 - implied probability)) x 100
2) If implied probability is less than or equal to .5 then I need R to run this formula and ignore the 1st formula:
Moneyline odds = (100 - implied probability / implied probability ) x 100
Any help in writing this into my script would be much appreciated!