Structure simplification - ready MVP

This commit is contained in:
Jakub Wajs 2019-06-14 18:32:12 +02:00
parent 6d1c9756ef
commit d6e61438fd
7 changed files with 91 additions and 128 deletions

122
.Rhistory
View File

@ -1,65 +1,4 @@
runApp() runApp()
runApp()
runApp()
View(football_data)
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
View(football_data)
getMatchesList("England", "Scotland", football_data)
getMatchesList("England", "Scotland", football_data) %>% arrange()
getMatchesList("England", "Scotland", football_data) %>% arrange(decreasing=TRUE)
getMatchesList("England", "Scotland", football_data) %>% arrange(.,decreasing=TRUE)
getMatchesList("England", "Scotland", football_data) %>% arrange(.$date)
getMatchesList("England", "Scotland", football_data) %>% arrange(.$date, decreasing=TRUE)
getMatchesList("England", "Scotland", football_data) %>% mutate(date = as.Date(date, "%Y-%m-%d")) %>% sort(date)
getMatchesList("England", "Scotland", football_data) %>% mutate(date = as.Date(date, "%Y-%m-%d")) %>% sort(date, decreasing = TRUE)
football_data %>% select(date)
football_data %>% select(date) %>% min()
football_data %>% select(date) %>% format(date, "%Y")
football_data %>% select(date) %>% format(.$date, "%Y")
football_data %>% select(date) %>% typeof()
football_data %>% select(date) %>% format(as.Date(date, format="%Y-%m-%d"),"%Y")
test <- football_data %>% select(date)
test[1]
test %>% head(1)
test %>% head(1) %>% format(., "%Y")
test %>% head(1) %>% typeof
test %>% head(1) %>% typeof()
football_data %>% select(date) %>% min()
football_data %>% select(date)
football_data %>% select(date) %>% aggregate(., by=list(.), max)
football_data %>% min(.$date)
football_data %>% select(date) %>% summarise(min = min(date))
football_data %>% select(date) %>% mutate(date = as.Date(date, "%Y-%m-%d")) %>% summarise(min = min(date))
football_data %>% select(date) %>% mutate(. = as.Date(date, "%Y-%m-%d")) %>% summarise(min = min(.))
football_data %>% select(date) %>% mutate(. = as.Date(., "%Y-%m-%d")) %>% summarise(min = min(.))
getDateFromData <- function(matchesData) {
return(
matchesData %>%
select(date) %>%
mutate(date = as.Date(date, "%Y-%m-%d"))
)
}
getDateFromData(football_data) %>%
summarise(max = max(date))
balance <- football_data %>%
count(winner, sort = TRUE)
return(balance)
runApp()
getDateFromData(football_data)
runApp()
runApp()
runApp()
runApp()
typeof(min_date_from) typeof(min_date_from)
getDateFromData(football_data) %>% getDateFromData(football_data) %>%
summarise(min = min(date)) %>% as.Date() summarise(min = min(date)) %>% as.Date()
@ -510,3 +449,64 @@ runApp()
version() version()
version version
packageVersion("shiny") packageVersion("shiny")
shiny::runApp()
test <- getMatchesForTeam("England")
test <- getMatchesForTeam(football_data"England")
test <- getMatchesForTeam(football_data, "England")
test %>% filter(home_team == "England") %>% select(.$home_score) %>% count()
test %>% filter(home_team == "England") %>% select(.$home_score)
test %>% filter(home_team == "England")
test %>% filter(home_team == "England") %>% count(home_score)
test %>% filter(home_team == "England")
test %>% filter(home_team == "England") %>% sum(home_score)
test %>% filter(home_team == "England") %>% summarise(home_score)
test %>% filter(home_team == "England") %>% aggregate(home_score)
test %>% filter(home_team == "England") %>% aggregate(home_score, sum)
test %>% filter(home_team == "England") %>% aggregate(sum)
test %>% filter(home_team == "England") %>% sum(as.numeric(.))
test %>% filter(home_team == "England") %>% sum()
test %>% filter(home_team == "England")
test %>% filter(home_team == "England") %>% select(home_score)
test %>% filter(home_team == "England") %>% select(home_score) %>% sum()
test %>% filter(home_team != "England") %>% select(home_score) %>% sum()
test %>% select(home_score) %>% sum()
home_goals <- test %>% filter(home_team == "England") %>% select(home_score) %>% sum()
away_goals <- test %>% filter(away_team == "England") %>% select(away_score) %>% sum()
goals_scored <- tribble(
~home_goals, ~away_goals, ~overall,
home_goals, away_goals, home_goals + away_goals
)
goals_scored
test %>% filter(home_team == "England") %>% count()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
install.packages("tmap")
install.packages("tmaptools")
install.packages("leaflet")
install.packages(c("leaflet", "tmap", "tmaptools"))
runApp()
data("World")
head(World)
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()
runApp()

View File

@ -1,9 +0,0 @@
#
# Interactive Map Component
#
interactiveMapStatistics <- function(input, output) {
output$interactive_world_map <- renderLeaflet(
leaflet(World) %>% addTiles() %>% setView(-93.65, 42.0285, zoom = 17)
)
}

View File

@ -6,7 +6,7 @@
source("Server/Results.R") source("Server/Results.R")
source("Server/DataProcessor.R") source("Server/DataProcessor.R")
source("Server/SummaryStatistics.R") source("Server/SummaryStatistics.R")
source("Server/InteractiveMapStatistics.R") # source("Server/InteractiveMapStatistics.R")
# Server logic # Server logic
server <- function(input, output) { server <- function(input, output) {
@ -21,5 +21,5 @@ server <- function(input, output) {
resultsWithPagination(input, output) resultsWithPagination(input, output)
# Tab 3 # Tab 3
interactiveMapStatistics(input, output) # interactiveMapStatistics(input, output)
} }

View File

@ -1,15 +1,15 @@
# Balance component # Balance component
balanceComponent <- function(pieChartSize, barplotSize) balanceComponent <- function()
{ {
fluidRow( tabsetPanel(
column(barplotSize, tabPanel("Bar graph",
wellPanel( wellPanel(
plotOutput("balance") plotOutput("balance")
) )
), ),
column(pieChartSize, tabPanel("Pie chart",
wellPanel( wellPanel(
plotOutput("balancePieChart") plotOutput("balancePieChart")
) )
) )

View File

@ -1,12 +0,0 @@
#
# Interactive map component
#
interactiveMapComponent <- function(rowSize)
{
fluidRow(
column(rowSize,
leafletOutput("interactive_world_map")
)
)
}

View File

@ -18,19 +18,19 @@ teamsSidebarPanel <- function() {
start = min_date_from, start = min_date_from,
end = max_date_to, end = max_date_to,
min = min_date_from, min = min_date_from,
max = max_date_to), max = max_date_to)
dropdownButton( #dropdownButton(
label = "Tournament types", # label = "Tournament types",
circle = FALSE, # circle = FALSE,
#radioButtons("tournament_all", #radioButtons("tournament_all",
# "Select:", # "Select:",
# choices = c("All", "None"), # choices = c("All", "None"),
# selected = "All"), # selected = "All"),
checkboxGroupInput("tournament_type", # checkboxGroupInput("tournament_type",
"Tournament type:", # "Tournament type:",
choices = tournament_types, # choices = tournament_types,
selected = tournament_types) # selected = tournament_types)
) #)
) )
) )
) )

42
UI/UI.R
View File

@ -5,7 +5,6 @@
# Import files # Import files
source("UI/SidebarPanel.R") source("UI/SidebarPanel.R")
source("UI/BalanceComponent.R") source("UI/BalanceComponent.R")
source("UI/InteractiveMapComponent.R")
# UI # UI
ui <- navbarPage( ui <- navbarPage(
@ -56,38 +55,23 @@ ui <- navbarPage(
teamsSidebarPanel() teamsSidebarPanel()
), ),
column(9, column(9,
tabsetPanel( fluidRow(
tabPanel( column(
"Charts", 6,
balanceComponent(6, 6), balanceComponent()
fluidRow(
DT::dataTableOutput("results_pagination")
)
), ),
tabPanel( column(
"Summary" 6
)
),
fluidRow(
column(
12,
DT::dataTableOutput("results_pagination")
) )
) )
) )
) )
), )
# Tab 3
tabPanel("Overall",
fluidRow(
column(12,
tabsetPanel(
tabPanel(
"Map",
interactiveMapComponent(12)
),
tabPanel(
"Summary"
),
tabPanel(
"All matches"
)
))
))
) )