Browse Source

Reactive filter sur GHM

master
Maxime Wack 7 years ago
parent
commit
972db9f298
1 changed files with 23 additions and 21 deletions
  1. +23
    -21
      app.R

+ 23
- 21
app.R View File

@@ -79,35 +79,37 @@ server <- function(input, output, session)
#addPolygons(weight = 1, color = "#222222", opacity = .1, fillOpacity = .1, fillColor = "#EEEEEE") %>%
setView(lat = 48.35, lng = 6, zoom = 8)
})
# Filter in bounds

# in bounds
in_bounds <- reactive({
if (is.null(input$map_bounds))
return(communes[F,])
return(communes[F,])
bounds <- input$map_bounds
latrng <- range(bounds$north, bounds$south)
lngrng <- range(bounds$east, bounds$west)
communes[lats >= latrng[1] & lats <= latrng[2] & lngs >= lngrng[1] & lngs <= lngrng[2],]
})

# 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({
# output$plot_age <- renderPlotly({
# filteredData() %>%


Loading…
Cancel
Save