diff --git a/.Rhistory b/.Rhistory index df7ff41..bd03f97 100644 --- a/.Rhistory +++ b/.Rhistory @@ -1,66 +1,3 @@ -shiny::runApp() -runApp() -# Load data -football_data <- read.csv("results.csv") -head(football_data) -football_data <- as_tibble(read.csv("results.csv")) -library(dplyr) -football_data <- as_tibble(read.csv("results.csv")) -football_data %>% select(2) -football_data %>% select("home_team") -football_data %>% select("home_team") %>% unique() -runApp() -runApp() -runApp() -runApp() -runApp() -runApp() -runApp() -shiny::runApp() -runApp(display.mode = "showcase") -runApp(display.mode = "showcase") -runApp() -get_matches_list <- function(home_team, away_team) { -matches <- football_data %>% -select(1:5) %>% -filter("home_team" == home_team -& "away_team" == away_team) -return(matches) -} -get_matches_list("Scotland", "England") -head(get_matches_list("Scotland", "England")) -test <- get_matches_list("Scotland", "England") -test <- get_matches_list("Poland", "England") -test -football_data %>% filter("home_team" == "England") -football_data %>% filter(1 == "England") -football_data %>% filter(2 == "England") -matches <- football_data %>% -select(1:5) %>% -filter("home_team" %in% c(first_team, second_team) -& "away_team" %>% c(first_team, second_team)) -matches <- football_data %>% -select(1:5) %>% -filter("home_team" %in% c("England") -) -football_data %>% filter(str_detect("home_team", "England") -) -library(stringr) -football_data %>% filter(str_detect("home_team", "England")_ -football_data %>% filter(str_detect("home_team", "England")) -football_data %>% filter(str_detect(2, "England")) -football_data %>% filter(home_team == "England") -runApp() -runApp() -football_data_ext <- football_data %>% -select(2:4) -head(football_data_ext) -football_data_ext <- football_data %>% -select(2:6) -head(football_data_ext) -head(football_data) -football_data["home_team"] -get_winner_name <- function(match_row) { if(match_row["home_score"] > match_row["away_score"]) { return(match_row["home_team"]) } @@ -503,3 +440,73 @@ runApp() runApp() runApp() runApp() +shiny::runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +balanceBetweenTeams(input, output) +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +install.packages("scales") +install.packages("scales") +shiny::runApp() +runApp() +runApp() +runApp() +runApp() +install.packages("scales") +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() +runApp() diff --git a/Server/Results.R b/Server/Results.R index eb9cb19..83b92e6 100644 --- a/Server/Results.R +++ b/Server/Results.R @@ -5,7 +5,7 @@ # Results with pagination getFilteredResults <- function(input) { getMatchesList(football_data, input$first_team, input$second_team) %>% - filterByDate(as_date(input$date_from), as_date(input$date_to)) + filterByDate(as_date(input$date_range[1]), as_date(input$date_range[2])) } resultsWithPagination <- function(input, output) { diff --git a/UI/SidebarPanel.R b/UI/SidebarPanel.R index 5c6168a..51455e4 100644 --- a/UI/SidebarPanel.R +++ b/UI/SidebarPanel.R @@ -2,22 +2,26 @@ teamsSidebarPanel <- function() { - sidebarPanel( - selectInput("first_team", - "First team:", - home_teams), - selectInput("second_team", - "Second team:", - away_teams), - dateInput("date_from", - "Date from:", - value = min_date_from, - min = min_date_from, - max = max_date_to), - dateInput("date_to", - "Date to:", - value = max_date_to, - min = min_date_from, - max = max_date_to) + fluidRow( + column(12, + h2("Teams comparison"), + p("Choose teams you want to compare."), + fluidRow( + column(12, + selectInput("first_team", + "First team:", + home_teams), + selectInput("second_team", + "Second team:", + away_teams), + dateRangeInput("date_range", + "Date range:", + start = min_date_from, + end = max_date_to, + min = min_date_from, + max = max_date_to) + ) + ) + ) ) } \ No newline at end of file diff --git a/UI/UI.R b/UI/UI.R index efdfb72..ba12511 100644 --- a/UI/UI.R +++ b/UI/UI.R @@ -7,24 +7,28 @@ source("UI/SidebarPanel.R") source("UI/BalanceComponent.R") # UI -ui <- fluidPage( - theme = shinytheme("cerulean"), +ui <- navbarPage( + title = "Football results 1872-2018", + theme = shinytheme("united"), - # Application title - headerPanel("International football results 1872-2018"), + # Tab 1 + tabPanel("Team statistics"), - # Sidebar layout elements - sidebarLayout( - teamsSidebarPanel(), - - # Main panel - mainPanel( - fluidPage( + # Tab 2 + tabPanel("Teams comparison", + fluidRow( + column(4, + teamsSidebarPanel() + ), + column(8, balanceComponent(6, 6), fluidRow( DT::dataTableOutput("results_pagination") ) ) ) - ) + ), + + # Tab 3 + tabPanel("World map") ) \ No newline at end of file