fracToDec: Convert odds from fraction to decimal

Description Usage Arguments Value Examples

Description

partialMatch converts betting odds from fraction to decimal. By default, Oddschecker provides odds as fractions, while the exchange utilise decimal odds. To allow easier comparision, we need to convert the fractional odds to decimal. The function also returns negative under specific scenarios (e.g. no odds).

Usage

1
fracToDec(price)

Arguments

price

String. A string representing the odds of a bet, expressed in fractional form (e.g. 5/4).

Value

The output of the function is a numeric. In the event of "SP", 0.0 is returned, while "" is conveted -1.0.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 

# 2.25 is the decimal form of "5/4"

fracToDec("5/4")

# We can map a vector of fractional odds to their decimal form equivalent

sapply(c("5/4","8/11","4/6","5","22/2"),fracToDec)

# Finally, sometimes the odds are not provided, or at least not in fractional form.
To account for this, specific numbers are returned.

sapply(c("EVS","SP",""),fracToDec)


## End(Not run)

dashee87/betScrapeR documentation built on May 14, 2019, 6:12 p.m.