TPD-InternationalFootballRe.../Server/DataProcessor.R

22 lines
504 B
R
Raw Normal View History

2019-05-15 19:56:07 +02:00
#
# DATA PROCESSING
#
# Functions
getMatchesList <- function(first_team, second_team, football_data) {
matches <- football_data %>%
filter(home_team %in% c(first_team, second_team)
& away_team %in% c(first_team, second_team))
return(matches)
}
getBalance <- function(football_data) {
balance <- football_data %>%
count(winner, sort = TRUE)
return(balance)
}
getBalancePercentage <- function(balance) {
balancePerc <- balance %>%
mutate(percentage = n/sum(.$n) * 100)
}