I am trying to produce a map of income levels in various council areas in Sydney using leaflet. While I was able to produce circlemarkers, I have been hoping to produce the same results in polygons.
I have come across a shapefile from Councils in New South Wales, which I have managed to import to R and produce some maps in there, and then I tried merging that spatialpolygondataframe with my income dataframe using the council name, but this wasn't getting me the results that I hoped for. Below is my code, where newobj is my combined dataframe.
leaflet() %>%
addProviderTiles("CartoDB.Positron", options= providerTileOptions(opacity = 0.99)) %>%
addPolygons(data = newobj$`Crimes against the person`,
stroke = FALSE, fillOpacity = 0.5, smoothFactor = 0.5
)
I basically received a few errors in there and could not produce the map.
I actually just managed to find another solution using TMAP package on R, with adding the details of my dataset to the data table of my spatial polygons.