22 lines
504 B
R
22 lines
504 B
R
#
|
|
# 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)
|
|
} |