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()
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)
getDateFromData(football_data) %>%
summarise(min = min(date)) %>% as.Date()
@ -510,3 +449,64 @@ runApp()
version()
version
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/DataProcessor.R")
source("Server/SummaryStatistics.R")
source("Server/InteractiveMapStatistics.R")
# source("Server/InteractiveMapStatistics.R")
# Server logic
server <- function(input, output) {
@ -21,5 +21,5 @@ server <- function(input, output) {
resultsWithPagination(input, output)
# Tab 3
interactiveMapStatistics(input, output)
# interactiveMapStatistics(input, output)
}

View File

@ -1,15 +1,15 @@
# Balance component
balanceComponent <- function(pieChartSize, barplotSize)
balanceComponent <- function()
{
fluidRow(
column(barplotSize,
wellPanel(
tabsetPanel(
tabPanel("Bar graph",
wellPanel(
plotOutput("balance")
)
),
column(pieChartSize,
wellPanel(
tabPanel("Pie chart",
wellPanel(
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,
end = max_date_to,
min = min_date_from,
max = max_date_to),
dropdownButton(
label = "Tournament types",
circle = FALSE,
max = max_date_to)
#dropdownButton(
# label = "Tournament types",
# circle = FALSE,
#radioButtons("tournament_all",
# "Select:",
# choices = c("All", "None"),
# selected = "All"),
checkboxGroupInput("tournament_type",
"Tournament type:",
choices = tournament_types,
selected = tournament_types)
)
# checkboxGroupInput("tournament_type",
# "Tournament type:",
# choices = tournament_types,
# selected = tournament_types)
#)
)
)
)

42
UI/UI.R
View File

@ -5,7 +5,6 @@
# Import files
source("UI/SidebarPanel.R")
source("UI/BalanceComponent.R")
source("UI/InteractiveMapComponent.R")
# UI
ui <- navbarPage(
@ -56,38 +55,23 @@ ui <- navbarPage(
teamsSidebarPanel()
),
column(9,
tabsetPanel(
tabPanel(
"Charts",
balanceComponent(6, 6),
fluidRow(
DT::dataTableOutput("results_pagination")
)
fluidRow(
column(
6,
balanceComponent()
),
tabPanel(
"Summary"
column(
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"
)
))
))
)
)