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 ✔ * Balance for one team ✔
* Basic layout ✔ * Basic layout ✔
* Barplot for percentage balance ✔ * Barplot for percentage balance ✔
* Basic summary statistics per team/teams ✔
## TODO ## TODO
* Basic summary statistics per team/teams ⛔
* Exception handling ⛔ * Exception handling ⛔
* Country filtering ⚠ * Country filtering ⚠
* Fix for columns naming in data table ⚠ * Fix for columns naming in data table ⚠

View File

@ -86,7 +86,12 @@ balancePercentage <- function(input, output) {
# Summary statistics # Summary statistics
summaryStatistics <- function(input, output) { summaryStatistics <- function(input, output) {
output$summary_statistics <- renderTable( 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 rownames = TRUE
) )
} }

View File

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

15
UI/UI.R
View File

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

1
app.R
View File

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