|
@@ -79,35 +79,37 @@ server <- function(input, output, session) |
|
|
#addPolygons(weight = 1, color = "#222222", opacity = .1, fillOpacity = .1, fillColor = "#EEEEEE") %>% |
|
|
#addPolygons(weight = 1, color = "#222222", opacity = .1, fillOpacity = .1, fillColor = "#EEEEEE") %>% |
|
|
setView(lat = 48.35, lng = 6, zoom = 8) |
|
|
setView(lat = 48.35, lng = 6, zoom = 8) |
|
|
}) |
|
|
}) |
|
|
# Filter in bounds |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# in bounds |
|
|
in_bounds <- reactive({ |
|
|
in_bounds <- reactive({ |
|
|
if (is.null(input$map_bounds)) |
|
|
if (is.null(input$map_bounds)) |
|
|
return(communes[F,]) |
|
|
|
|
|
|
|
|
return(communes[F,]) |
|
|
bounds <- input$map_bounds |
|
|
bounds <- input$map_bounds |
|
|
latrng <- range(bounds$north, bounds$south) |
|
|
latrng <- range(bounds$north, bounds$south) |
|
|
lngrng <- range(bounds$east, bounds$west) |
|
|
lngrng <- range(bounds$east, bounds$west) |
|
|
communes[lats >= latrng[1] & lats <= latrng[2] & lngs >= lngrng[1] & lngs <= lngrng[2],] |
|
|
communes[lats >= latrng[1] & lats <= latrng[2] & lngs >= lngrng[1] & lngs <= lngrng[2],] |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
# Filter GHM |
|
|
# Filter GHM |
|
|
# filteredData <- reactive({ |
|
|
|
|
|
# GHM %>% |
|
|
|
|
|
# filter(Sexe %in% input$check_sexe, |
|
|
|
|
|
# Age <= input$slider_age[2] & Age >= input$slider_age[1], |
|
|
|
|
|
# GHM %in% input$choice_ghm, |
|
|
|
|
|
# date_entree <= input$slider_date[2] & date_sortie >= input$slider_date[1], |
|
|
|
|
|
# CP %in% in_bounds$insee) |
|
|
|
|
|
# }) |
|
|
|
|
|
# Plots |
|
|
|
|
|
# observe({ |
|
|
|
|
|
# output$plot_sexe <- renderPlotly({ |
|
|
|
|
|
# filteredData() %>% |
|
|
|
|
|
# ( |
|
|
|
|
|
# ggplot() + |
|
|
|
|
|
# aes(x = Sexe) + |
|
|
|
|
|
# geom_bar(position = "stacked") |
|
|
|
|
|
# ) %>% ggplotly |
|
|
|
|
|
# }) |
|
|
|
|
|
# }) |
|
|
|
|
|
|
|
|
filteredData <- reactive({ |
|
|
|
|
|
if (input$choice_ghm %>% is.null) |
|
|
|
|
|
{ |
|
|
|
|
|
GHM %>% |
|
|
|
|
|
filter(Sexe %in% input$check_sexe, |
|
|
|
|
|
Age <= input$slider_age[2] & Age >= input$slider_age[1], |
|
|
|
|
|
date_entree <= input$slider_date[2] & date_sortie >= input$slider_date[1], |
|
|
|
|
|
CP %in% in_bounds()$Codepos) |
|
|
|
|
|
} else |
|
|
|
|
|
{ |
|
|
|
|
|
GHM %>% |
|
|
|
|
|
filter(Sexe %in% input$check_sexe, |
|
|
|
|
|
Age <= input$slider_age[2] & Age >= input$slider_age[1], |
|
|
|
|
|
GHM %in% input$choice_ghm, |
|
|
|
|
|
date_entree <= input$slider_date[2] & date_sortie >= input$slider_date[1], |
|
|
|
|
|
CP %in% in_bounds()$Codepos) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
# observe({ |
|
|
# observe({ |
|
|
# output$plot_age <- renderPlotly({ |
|
|
# output$plot_age <- renderPlotly({ |
|
|
# filteredData() %>% |
|
|
# filteredData() %>% |
|
|