Summary statistics for team ready

This commit is contained in:
Jakub Wajs 2019-06-15 00:31:16 +02:00
parent 6c4b99c4c7
commit 93d8ab5e5a
5 changed files with 22 additions and 9 deletions

View File

@ -28,10 +28,10 @@ Created with R version 3.6.0 and Shiny 1.3.2
* Balance for one team ✔
* Basic layout ✔
* Barplot for percentage balance ✔
* Basic summary statistics per team/teams ✔
## TODO
* Basic summary statistics per team/teams ⛔
* Exception handling ⛔
* Country filtering ⚠
* Fix for columns naming in data table ⚠

View File

@ -86,7 +86,12 @@ balancePercentage <- function(input, output) {
# Summary statistics
summaryStatistics <- function(input, output) {
output$summary_statistics <- renderTable(
goalsOverallSummary(getFilteredResultsForTeam(input), input$team),
formattable(result <- goalsOverallSummary(getFilteredResultsForTeam(input), input$team),
list(
Home = color_tile("white", "orange")
)
),
width = '100%',
rownames = TRUE
)
}

View File

@ -87,9 +87,9 @@ goalsOverallSummary <- function(matches, team) {
lostAvg <- avgGoalsLost(matches, team)
goalsOverall <- data.frame(
"Home" = c(scored$home_goals, lost$home_goals, scoredAvg$home_goals_avg, lostAvg$home_goals_avg),
"Away" = c(scored$away_goals, lost$away_goals, scoredAvg$away_goals_avg, lostAvg$away_goals_avg),
"Overall" = c(scored$overall, lost$overall, scoredAvg$overall_avg, lostAvg$overall_avg),
Home = c(scored$home_goals, lost$home_goals, scoredAvg$home_goals_avg, lostAvg$home_goals_avg),
Away = c(scored$away_goals, lost$away_goals, scoredAvg$away_goals_avg, lostAvg$away_goals_avg),
Overall = c(scored$overall, lost$overall, scoredAvg$overall_avg, lostAvg$overall_avg),
stringsAsFactors = FALSE
)
row.names(goalsOverall) <- c("Scored","Lost", "Scored Avg", "Lost Avg")

15
UI/UI.R
View File

@ -21,10 +21,10 @@ ui <- navbarPage(
fluidRow(
column(
6,
h2("Matches balance chart"),
tabsetPanel(
tabPanel(
"Charts",
h2("Matches balance charts"),
"Bar plot",
wellPanel(
plotOutput("balance_for_team")
)
@ -33,8 +33,14 @@ ui <- navbarPage(
),
column(
6,
wellPanel(
tableOutput("summary_statistics")
h2("Overall statistics"),
tabsetPanel(
tabPanel(
"Summary",
wellPanel(
tableOutput("summary_statistics")
)
)
)
)
)
@ -58,6 +64,7 @@ ui <- navbarPage(
fluidRow(
column(
6,
h2("Matches balance charts"),
balanceComponent()
),
column(

1
app.R
View File

@ -17,6 +17,7 @@ library(scales)
library(tmap)
library(tmaptools)
library(leaflet)
library(formattable)
# Load files
source("Data/Loader.R")