Improved general look and feel. Added tabs and new sidebar
This commit is contained in:
parent
3b077f5269
commit
7d66641386
133
.Rhistory
133
.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"]) {
|
if(match_row["home_score"] > match_row["away_score"]) {
|
||||||
return(match_row["home_team"])
|
return(match_row["home_team"])
|
||||||
}
|
}
|
||||||
@ -503,3 +440,73 @@ runApp()
|
|||||||
runApp()
|
runApp()
|
||||||
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()
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
# Results with pagination
|
# Results with pagination
|
||||||
getFilteredResults <- function(input) {
|
getFilteredResults <- function(input) {
|
||||||
getMatchesList(football_data, input$first_team, input$second_team) %>%
|
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) {
|
resultsWithPagination <- function(input, output) {
|
||||||
|
@ -2,22 +2,26 @@
|
|||||||
|
|
||||||
teamsSidebarPanel <- function()
|
teamsSidebarPanel <- function()
|
||||||
{
|
{
|
||||||
sidebarPanel(
|
fluidRow(
|
||||||
selectInput("first_team",
|
column(12,
|
||||||
"First team:",
|
h2("Teams comparison"),
|
||||||
home_teams),
|
p("Choose teams you want to compare."),
|
||||||
selectInput("second_team",
|
fluidRow(
|
||||||
"Second team:",
|
column(12,
|
||||||
away_teams),
|
selectInput("first_team",
|
||||||
dateInput("date_from",
|
"First team:",
|
||||||
"Date from:",
|
home_teams),
|
||||||
value = min_date_from,
|
selectInput("second_team",
|
||||||
min = min_date_from,
|
"Second team:",
|
||||||
max = max_date_to),
|
away_teams),
|
||||||
dateInput("date_to",
|
dateRangeInput("date_range",
|
||||||
"Date to:",
|
"Date range:",
|
||||||
value = max_date_to,
|
start = min_date_from,
|
||||||
min = min_date_from,
|
end = max_date_to,
|
||||||
max = max_date_to)
|
min = min_date_from,
|
||||||
|
max = max_date_to)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
28
UI/UI.R
28
UI/UI.R
@ -7,24 +7,28 @@ source("UI/SidebarPanel.R")
|
|||||||
source("UI/BalanceComponent.R")
|
source("UI/BalanceComponent.R")
|
||||||
|
|
||||||
# UI
|
# UI
|
||||||
ui <- fluidPage(
|
ui <- navbarPage(
|
||||||
theme = shinytheme("cerulean"),
|
title = "Football results 1872-2018",
|
||||||
|
theme = shinytheme("united"),
|
||||||
|
|
||||||
# Application title
|
# Tab 1
|
||||||
headerPanel("International football results 1872-2018"),
|
tabPanel("Team statistics"),
|
||||||
|
|
||||||
# Sidebar layout elements
|
# Tab 2
|
||||||
sidebarLayout(
|
tabPanel("Teams comparison",
|
||||||
teamsSidebarPanel(),
|
fluidRow(
|
||||||
|
column(4,
|
||||||
# Main panel
|
teamsSidebarPanel()
|
||||||
mainPanel(
|
),
|
||||||
fluidPage(
|
column(8,
|
||||||
balanceComponent(6, 6),
|
balanceComponent(6, 6),
|
||||||
fluidRow(
|
fluidRow(
|
||||||
DT::dataTableOutput("results_pagination")
|
DT::dataTableOutput("results_pagination")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
),
|
||||||
|
|
||||||
|
# Tab 3
|
||||||
|
tabPanel("World map")
|
||||||
)
|
)
|
Loading…
Reference in New Issue
Block a user