diff --git a/README.md b/README.md index 44a240d..57de9e0 100644 --- a/README.md +++ b/README.md @@ -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 ⚠ diff --git a/Server/Results.R b/Server/Results.R index 7cf66b1..0eebea8 100644 --- a/Server/Results.R +++ b/Server/Results.R @@ -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 ) } \ No newline at end of file diff --git a/Server/SummaryStatistics.R b/Server/SummaryStatistics.R index ee77e18..6746268 100644 --- a/Server/SummaryStatistics.R +++ b/Server/SummaryStatistics.R @@ -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") diff --git a/UI/UI.R b/UI/UI.R index b7ab9c7..800e6d2 100644 --- a/UI/UI.R +++ b/UI/UI.R @@ -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( diff --git a/app.R b/app.R index c1da7c4..ea4700f 100644 --- a/app.R +++ b/app.R @@ -17,6 +17,7 @@ library(scales) library(tmap) library(tmaptools) library(leaflet) +library(formattable) # Load files source("Data/Loader.R")