Browse Source

Renommage CP par Codepos dans les GHM pour join plus facile

master
Maxime Wack 7 years ago
parent
commit
50509f1d4c
1 changed files with 7 additions and 7 deletions
  1. +7
    -7
      app.R

+ 7
- 7
app.R View File

@@ -10,7 +10,7 @@ library(lubridate)

# Lecture fichier de GHM ----
read_csv("ghm.csv", col_types = cols(IPP = col_character())) %>%
`names<-`(c("IPP", "IEP", "Age", "Sexe", "CP", "GHM", "date_entree", "date_sortie")) %>%
`names<-`(c("IPP", "IEP", "Age", "Sexe", "Codepos", "GHM", "date_entree", "date_sortie")) %>%
mutate(date_entree = date_entree %>% as.Date(format = "%Y/%m/%d"),
date_sortie = date_sortie %>% as.Date(format = "%Y/%m/%d"),
DS = as.numeric(date_sortie - date_entree),
@@ -29,7 +29,7 @@ rm(racines)
read_csv2("insee.csv", col_types = cols(INSEE = col_character())) %>%
select(Codepos, insee = INSEE) %>%
mutate(insee = insee %>% str_pad(5, "left", "0")) %>%
filter(Codepos %in% GHM$CP) -> insee
filter(Codepos %in% GHM$Codepos) -> insee

# Lecture carte et join avec codes postaux ----
readOGR("communes", "communes-20150101-100m") -> communes
@@ -116,7 +116,7 @@ server <- function(input, output, session)
GHM %>%
filter(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 %in% in_bounds(),
Sexe %in% input$check_sexe)
})

@@ -142,14 +142,14 @@ server <- function(input, output, session)
GHM %>%
filter(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 %in% in_bounds())
} else
{
GHM %>%
filter(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 %in% in_bounds())
}
})

@@ -173,14 +173,14 @@ server <- function(input, output, session)
GHM %>%
filter(Sexe %in% input$check_sexe,
date_entree <= input$slider_date[2] & date_sortie >= input$slider_date[1],
CP %in% in_bounds())
Codepos %in% in_bounds())
} else
{
GHM %>%
filter(Sexe %in% input$check_sexe,
GHM %in% input$choice_ghm,
date_entree <= input$slider_date[2] & date_sortie >= input$slider_date[1],
CP %in% in_bounds())
Codepos %in% in_bounds())
}
})
output$plot_age <- renderPlot({


Loading…
Cancel
Save