2019-05-15 19:56:07 +02:00
|
|
|
#
|
|
|
|
# RESULTS
|
|
|
|
#
|
2019-05-15 00:27:04 +02:00
|
|
|
|
|
|
|
# Results with pagination
|
|
|
|
resultsWithPagination <- function(input, output) {
|
|
|
|
output$results_pagination <- DT::renderDataTable(
|
|
|
|
getMatchesList(input$first_team, input$second_team, football_data),
|
|
|
|
extensions = 'Buttons',
|
|
|
|
options = list(
|
|
|
|
lengthMenu = list(c(5, 10, -1), c('5', '10', 'All')),
|
|
|
|
pageLength = 10,
|
|
|
|
searching = FALSE
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
# Balance
|
|
|
|
balanceBetweenTeams <- function(input, output) {
|
|
|
|
output$balance <- renderPlot({
|
|
|
|
barplot(
|
2019-05-15 19:56:07 +02:00
|
|
|
getBalance(getMatchesList(input$first_team, input$second_team, football_data_ext))$n,
|
2019-05-15 00:27:04 +02:00
|
|
|
main = "Balance between teams",
|
|
|
|
col = rainbow(3),
|
|
|
|
names.arg = getBalance(getMatchesList(input$first_team, input$second_team, football_data_ext))$winner
|
|
|
|
)
|
|
|
|
})
|
2019-05-15 19:56:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# Balance percentage
|
|
|
|
balancePercentage <- function(input, output) {
|
|
|
|
output$balancePieChart <- renderPlot({
|
|
|
|
pie(
|
|
|
|
getBalancePercentage(
|
|
|
|
getBalance(getMatchesList(input$first_team, input$second_team, football_data_ext))
|
|
|
|
)$percentage,
|
|
|
|
main = "Match balance (percentage)",
|
|
|
|
labels = getBalancePercentage(
|
|
|
|
getBalance(getMatchesList(input$first_team, input$second_team, football_data_ext))
|
|
|
|
)$winner,
|
|
|
|
col = rainbow(3)
|
|
|
|
)
|
|
|
|
})
|
2019-05-15 00:27:04 +02:00
|
|
|
}
|