diff --git a/.RData b/.RData index fce75e7..5e97baf 100644 Binary files a/.RData and b/.RData differ diff --git a/.Rhistory b/.Rhistory index b76cc8b..0df18df 100644 --- a/.Rhistory +++ b/.Rhistory @@ -155,3 +155,125 @@ runApp() runApp() runApp() runApp() +shiny::runApp() +runApp() +install.packages("dt") +install.packages("DT") +install.packages(c("DT", "shiny")) +install.packages(c("DT", "shiny")) +shiny::runApp() +runApp() +runApp() +runApp() +exit() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +# Functions +get_matches_list <- function(first_team, second_team) { +matches <- football_data %>% +select(1:9) %>% +filter(home_team %in% c(first_team, second_team) +& away_team %in% c(first_team, second_team)) +return(matches) +} +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +View(football_data_ext) +getBalance <- function(data, home_team, away_team) { +balance <- data %>% +group_by(., "winner") %>% +summarise(n = n()) +return(balance) +} +test <- getBalance(football_data_ext, "England", "Scotland") +test +head(test) +balance <- football_data_ext %>% group_by(., "winner") +View(balance) +balance <- football_data_ext %>% aggregate(,. by="winner") +balance <- football_data_ext %>% aggregate(., by="winner") +balance <- football_data_ext %>% aggregate(., by="winner", FUN = sum()) +balance <- football_data_ext %>% aggregate(., by="winner", FUN = sum +) +balance <- football_data_ext %>% aggregate(., by=list(.$winner), FUN = sum) +balance <- football_data_ext %>% aggregate(., by=list(as.numeric(.$winner)), FUN = sum) +View(balance) +balance <- football_data_ext %>% group_by(., .$winner) +View(balance) +balance <- football_data_ext %>% group_by(.$winner) +View(balance) +balance <- football_data_ext %>% group_by(winner) +View(balance) +balance <- football_data_ext %>% count(winner) +View(balance) +getBalance <- function(data, home_team, away_team) { +balance <- data %>% +count(winner, sort = TRUE) +return(balance) +} +View(test) +test <- get_matches_list("England", "Scotland") +View(test) +getMatchesList <- function(first_team, second_team) { +matches <- football_data_ext %>% +select(1:9) %>% +filter(home_team %in% c(first_team, second_team) +& away_team %in% c(first_team, second_team)) +return(matches) +} +getMatchesList("England", "Scotland") +# Functions +getMatchesList <- function(first_team, second_team) { +matches <- football_data_ext %>% +filter(home_team %in% c(first_team, second_team) +& away_team %in% c(first_team, second_team)) +return(matches) +} +getMatchesList("England", "Scotland") +test <- getMatchesList("England", "Scotland") +runApp() +getBalance(test, "England", "Scotland") +barplot(getBalance( +getMatchesList(input$first_team, input$second_team, football_data_ext))) +runApp() +bal <- getBalance(getMatchesList(input$first_team, input$second_team, football_data_ext)) +bal <- getBalance(getMatchesList("England", "Scotland", football_data_ext)) +bal +runApp() +runApp() +bal.n +bal <- getBalance(getMatchesList("England", "Scotland", football_data_ext)) +bal.n +bal$n +runApp() +bal$n +runApp() +typeof(bal) +runApp() +runApp() +runApp() +runApp() +runApp() +View(bal) +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() diff --git a/Server/main.R b/Server/main.R index 8fcfa4e..1753b9e 100644 --- a/Server/main.R +++ b/Server/main.R @@ -1,3 +1,7 @@ +# +# Main Server File +# + # Import files source("Server/Results.R") diff --git a/UI/SidebarPanel.R b/UI/SidebarPanel.R new file mode 100644 index 0000000..be867cc --- /dev/null +++ b/UI/SidebarPanel.R @@ -0,0 +1,13 @@ +# Teams sidebar panel + +teamsSidebarPanel <- function() +{ + sidebarPanel( + selectInput("first_team", + "First team:", + home_teams), + selectInput("second_team", + "Second team:", + away_teams) + ) +} \ No newline at end of file diff --git a/UI/main.R b/UI/main.R index 7b117b1..18b5a45 100644 --- a/UI/main.R +++ b/UI/main.R @@ -1,21 +1,21 @@ +# +# Main UI File +# + +# Import files +source("UI/SidebarPanel.R") + # UI ui <- fluidPage( # Application title titlePanel("International football results 1872-2018"), - # Sidebar with a slider input for number of bins + # Sidebar layout elements sidebarLayout( - sidebarPanel( - selectInput("first_team", - "First team:", - home_teams), - selectInput("second_team", - "Second team:", - away_teams) - ), + teamsSidebarPanel(), - # Show a plot of the generated distribution + # Main panel mainPanel( plotOutput("balance"), DT::dataTableOutput("results_pagination")