Hi All,
I badly need your help in getting this resolved as I am struggling with this for weeks.
I copied the code for "Displaying shapes with custom projections" from the below link:
https://rstudio.github.io/leaflet/projections.html
library(leaflet)
library(sp)
library(albersusa)
spdf <- rmapshaper::ms_simplify(usa_sf(), keep = 0.1)
pal <- colorNumeric("Blues", domain = spdf$pop_2014)
epsg2163 <- leafletCRS(
crsClass = "L.Proj.CRS",
code = "EPSG:2163",
proj4def = "+proj=laea +lat_0=45 +lon_0=-100 +x_0=0 +y_0=0 +a=6370997 +b=6370997 +units=m +no_defs",
resolutions = 2^(16:7))
leaflet(spdf, options = leafletOptions(crs = epsg2163)) %>%
addPolygons(weight = 1, color = "#444444", opacity = 1,
fillColor = ~pal(pop_2014), fillOpacity = 0.7, smoothFactor = 0.5,
label = ~paste(name, pop_2014),
labelOptions = labelOptions(direction = "auto"))
The above code displays the map with tool tips.
filteredData2 <- reactive({
spdf[spdf$MMWRyear == input$MMWRyear1[1] & spdf$population == input$population1[1] & spdf$MMWRweek == input$slider2[1],]
})
When I try to add a reactive feature (above code) with drop downs and sliders and when I try to pass "filteredData2()" in place of spdf in the line "leaflet(spdf, options = leafletOptions(crs = epsg2163)) %>%" in the map code I am getting the error "Error in sum: invalid 'type' (list) of argument". I was able to add the drop downs to a different leaflet map and that was working map. But this one is giving me this error. I am clueless on what needs to be done.
Need someones help.
Thanks in advance.