UI files refactoring
This commit is contained in:
parent
662e1bb737
commit
d7e82ad610
122
.Rhistory
122
.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()
|
||||
|
@ -1,3 +1,7 @@
|
||||
#
|
||||
# Main Server File
|
||||
#
|
||||
|
||||
# Import files
|
||||
source("Server/Results.R")
|
||||
|
||||
|
13
UI/SidebarPanel.R
Normal file
13
UI/SidebarPanel.R
Normal file
@ -0,0 +1,13 @@
|
||||
# Teams sidebar panel
|
||||
|
||||
teamsSidebarPanel <- function()
|
||||
{
|
||||
sidebarPanel(
|
||||
selectInput("first_team",
|
||||
"First team:",
|
||||
home_teams),
|
||||
selectInput("second_team",
|
||||
"Second team:",
|
||||
away_teams)
|
||||
)
|
||||
}
|
20
UI/main.R
20
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")
|
||||
|
Loading…
Reference in New Issue
Block a user