I started a few days ago to learn about shiny and leaflet pakages, this question is maybe irrelevant but I looked for an answer to my problem and didn't found any. Well, I am trying to create an interactive map, with a base map that I've got from internet. I would like to represent on this map the evolution of an index across the country.
stypof <- readOGR(dsn = "C:/Users/N4XW6M/Desktop/nouvelle map/fonds typo propre.TAB", layer = "fonds typo propre", stringsAsFactors = FALSE)
names(stypof@data)<-c("typo")
fond<-data.frame(stypof@data$typo)
names(fond)<-c("typo")
new_indice_mois <- sqldf("SELECT indice_mois.*
FROM indice_mois, fond
WHERE indice_mois.typo = fond.typo")
stypof$indice_fevrier <- new_indice_mois$indice_fevrier
leaflet(stypof) %>%
addPolygons(
stroke = FALSE, fillOpacity = 0.5, smoothFactor = 0.5,
color = ~colorQuantile("YlOrRd", stypof@data$indice_fevrier)(indice_fevrier)
)
In a first step I import the base map using readOGR. Some areas are not represented in the base map that's why I use the sqldf function, then I add the index (indice_fevrier) to the map and try to use the leaflet function. I get no error message only an empty map. I tryed some other examples that I found on internet and I always have the same issue the map doesn't appear.