Summary statistics added
This commit is contained in:
parent
70c70cd7f8
commit
6c4b99c4c7
@ -86,6 +86,7 @@ balancePercentage <- function(input, output) {
|
|||||||
# Summary statistics
|
# Summary statistics
|
||||||
summaryStatistics <- function(input, output) {
|
summaryStatistics <- function(input, output) {
|
||||||
output$summary_statistics <- renderTable(
|
output$summary_statistics <- renderTable(
|
||||||
goalsScored(getFilteredResultsForTeam(input), input$team)
|
goalsOverallSummary(getFilteredResultsForTeam(input), input$team),
|
||||||
|
rownames = TRUE
|
||||||
)
|
)
|
||||||
}
|
}
|
@ -34,7 +34,7 @@ goalsLost <- function(matches, team) {
|
|||||||
home_goals, away_goals, home_goals + away_goals
|
home_goals, away_goals, home_goals + away_goals
|
||||||
)
|
)
|
||||||
|
|
||||||
return(goals_scored)
|
return(goals_lost)
|
||||||
}
|
}
|
||||||
|
|
||||||
matchesNumber <- function(matches, team) {
|
matchesNumber <- function(matches, team) {
|
||||||
@ -77,4 +77,22 @@ avgGoalsLost <- function(matches, team) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
return(avg_goals_lost)
|
return(avg_goals_lost)
|
||||||
|
}
|
||||||
|
|
||||||
|
# Summary
|
||||||
|
goalsOverallSummary <- function(matches, team) {
|
||||||
|
scored <- goalsScored(matches, team)
|
||||||
|
scoredAvg <- avgGoalsScored(matches, team)
|
||||||
|
lost <- goalsLost(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),
|
||||||
|
stringsAsFactors = FALSE
|
||||||
|
)
|
||||||
|
row.names(goalsOverall) <- c("Scored","Lost", "Scored Avg", "Lost Avg")
|
||||||
|
|
||||||
|
return(goalsOverall)
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user