Hello i want to build a shiny app with a leaflet map. I cannot even create it wuthout connecting it to widgets. I take the error message: Error in polygonData.default: Don't know how to get path data from object of class data.frame. My data has the form below. How should i put these variables in the renderLeaflet?:
subregion long lat group order region EQI County_ID
1 abbeville -82.24809 34.21131 2285 67187 south carolina 0.064558 45001
2 abbeville -82.27674 34.10818 2285 67190 south carolina 0.064558 45001
3 abbeville -82.23663 34.18266 2285 67188 south carolina 0.064558 45001
4 abbeville -82.24236 34.15401 2285 67189 south carolina 0.064558 45001
5 abbeville -82.30538 34.08526 2285 67191 south carolina 0.064558 45001
6 abbeville -82.60332 34.05088 2285 67203 south carolina 0.064558 45001
air_EQI water_EQI land_EQI sociod_EQI air_EQI.1 built_EQI good_days
1 0.3634782 0.9929249 -0.0150723 -0.2205935 0.3634782 -0.4392307 12.37
2 0.3634782 0.9929249 -0.0150723 -0.2205935 0.3634782 -0.4392307 12.37
3 0.3634782 0.9929249 -0.0150723 -0.2205935 0.3634782 -0.4392307 12.37
4 0.3634782 0.9929249 -0.0150723 -0.2205935 0.3634782 -0.4392307 12.37
5 0.3634782 0.9929249 -0.0150723 -0.2205935 0.3634782 -0.4392307 12.37
6 0.3634782 0.9929249 -0.0150723 -0.2205935 0.3634782 -0.4392307 12.37
bad_days
1 2.3
2 2.3
3 2.3
4 2.3
5 2.3
6 2.3
i couldalso use this dataset
A tibble: 6 x 10
County_ID County_Name EQI air_EQI water_EQI land_EQI
<int> <chr> <dbl> <dbl> <dbl> <dbl>
1 1001 Autauga, AL 0.0041379 0.9553846 -1.1097280 -0.7065906
2 1003 Baldwin, AL 0.2002343 0.7179643 -0.5659107 -1.0842990
3 1005 Barbour, AL -0.9506388 0.1310074 -0.9780902 -1.2814700
4 1007 Bibb, AL -1.0889200 0.0652890 -0.9681726 -0.8274103
5 1009 Blount, AL -0.5139221 0.4021944 -0.7186447 -0.6229339
6 1011 Bullock, AL -2.0828290 -0.3091858 -1.4513350 -1.2580140
# ... with 4 more variables: sociod_EQI <dbl>, built_EQI <dbl>,
# good_days <dbl>, bad_days <dbl>
>
and this is part of my code
#ui.r
#server.r
output$plot1<-renderLeaflet({
pal <- colorNumeric("viridis", NULL)
leaflet(Envirnoment) %>%
addTiles() %>%
addPolygons(stroke = FALSE, smoothFactor = 0.3, fillOpacity = 1,
fillColor = ~pal(log10(EQI)),
label = ~paste0(County_ID, ": ", formatC(EQI, big.mark = ","))) %>%
addLegend(pal = pal, values = ~log10(EQI), opacity = 1.0,
labFormat = labelFormat(transform = function(x) round(10^x)))
})