Commit 718d29a1 authored by vbaudrot's avatar vbaudrot

test 3 immunity item

parent 791b9982
Pipeline #1891 passed with stages
in 3 minutes and 25 seconds
......@@ -71,9 +71,20 @@ labelText = function(x,y,z){
# library(readr)
# immun_M3_k = list()
# vecDate = c("2020-04-06",
# "2020-04-13",
# "2020-04-20",
# "2020-04-27",
# "2020-05-04",
# "2020-05-11",
# "2020-05-18",
# "2020-05-25",
# "2020-06-01",
# "2020-06-08")
# for(i in 1:10){
# immun_M3_k[[i]] = as.numeric(readr::read_csv(paste0("~/Documents/coronavirus/immunity/immun_M3_k", i,".txt"), col_names = FALSE))
# immun_M3_k[[i]] = as.numeric(readr::read_csv(paste0("~/Documents/coronavirus/immunity/immun_M3_k", i,".txt"), col_names = FALSE))
# }
# names(immun_M3_k) = vecDate
# write_rds(immun_M3_k, "www/immun_M3_k.rds")
#
# library(sf)
......@@ -91,6 +102,7 @@ labelText = function(x,y,z){
mapFranceDepartement = readRDS("www/mapFranceDepartement.rds")
immun_M3_k = readRDS("www/immun_M3_k.rds")
immunityDate = as.Date(names(immun_M3_k))
# I = dataDEATHclean %>%
# dplyr::filter(`Country/Region` == "France" && is.na(`Province/State`) ) %>%
......
......@@ -293,17 +293,15 @@ server <- function(input, output, session){
#############################################################################
# Reactive expression for the data subsetted to what the user selected
selection=rep(TRUE,95)
selection[20] = FALSE
dataImmunity <- reactive({
selection=rep(TRUE,95)
selection[20] = FALSE
mapFranceDepartement$Rt_immunity = immun_M3_k[[input$DateSelectImmunty]][selection]
mapFranceDepartement$Rt_immunity =
immun_M3_k[[as.character(input$DateSelectImmunty)]][selection]
return(mapFranceDepartement) # return
})
palImmunity <- colorNumeric(palette = "YlOrRd",
domain = unlist(immun_M3_k))
palImmunity <- colorNumeric(palette = "YlOrRd", domain = unlist(immun_M3_k))
output$mapImmunity <- renderLeaflet({
leaflet(data = dataImmunity()) %>%
......@@ -312,19 +310,20 @@ server <- function(input, output, session){
addLegend(position = "bottomright",
title = "Rate immunity",
pal = palImmunity,
values = ~unlist(immun_M3_k))
values = ~ unlist(immun_M3_k))
})
#
# # Use a separate observer to recreate polygons as needed.
# observe({
# proxy <- leafletProxy("mapImmunity", data = dataImmunity())
#
# proxy %>%
# addPolygons( weight = 2,
# # title = immunDays[[input$DateSelectImmunty]]
# color = ~palImmunity(Rt_immunity),
# fillOpacity = 0.7)
# })
# Use a separate observer to recreate polygons as needed.
observe({
proxy <- leafletProxy("mapImmunity", data = dataImmunity())
# leafletProxy("mapImmunity", data = dataImmunity()) %>%
proxy %>%
addPolygons(#data = dataImmunity(),
# title = ~input$DateSelectImmunty,
color = ~palImmunity(Rt_immunity),
fillOpacity = 0.7)
})
}
\ No newline at end of file
......@@ -158,12 +158,9 @@ ui <- tagList(
tabName = "Immunity",
fluidRow(
box(width = 12,
# column(width = 4,
sliderInput("DateSelectImmunty", "Days",
1, length(immun_M3_k),
value = 1, step = 1
)
# )
sliderInput("DateSelectImmunty", "Days",
min(immunityDate), max(immunityDate),
value = min(immunityDate), step = 7)
)
),
fluidRow(
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment