Last active
January 17, 2016 15:08
-
-
Save flovv/461dc6a505b21eda10a9 to your computer and use it in GitHub Desktop.
Soccer Betting Odds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(rvest) | |
require(stringr) | |
url <- "http://www.wettfreunde.net/bundesliga-absteiger-wetten/" | |
# Darmstadt | |
1/2.25 | |
1/2.3 | |
mv <- html(url) | |
tab <- mv %>% html_table | |
tab <- tab[[1]] | |
tab <- tab[4:nrow(tab),] | |
colnames(tab) <- c("Team", "mybet", "tipico", "bet365", "betsafe", "sportingbet") | |
tab$mybet<- 1/as.numeric(str_replace_all(tab$mybet, ",", ".")) | |
tab$tipico<- 1/as.numeric(str_replace_all(tab$tipico, ",", ".")) | |
tab$bet365<- 1/as.numeric(str_replace_all(tab$bet365, ",", ".")) | |
tab$betsafe<- 1/as.numeric(str_replace_all(tab$betsafe, ",", ".")) | |
######### | |
sum(tab$mybet, na.rm=T) | |
sum(tab$tipico, na.rm=T) | |
sum(tab$bet365, na.rm=T) | |
sum(tab$betsafe, na.rm=T) | |
########################## | |
########## normalizse odds! | |
tab$mybet<- tab$mybet / sum(tab$mybet, na.rm=T) * 2 | |
tab$tipico<- tab$tipico / sum(tab$tipico, na.rm=T) * 2 | |
tab$bet365<- tab$bet365 / sum(tab$bet365, na.rm=T) * 2 | |
tab$betsafe<- tab$betsafe / sum(tab$betsafe, na.rm=T) * 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment