1

Got code from here:

Map Australian cities - R spatial

But when I run it, it gives the map shown:

library(maps)
df <- world.cities[world.cities$country.etc == "Australia",]

library(leaflet)

## define a palette for hte colour
pal <- colorNumeric(palette = "YlOrRd",
                    domain = df$pop)



library(leaflet)

## define a palette for hte colour
pal <- colorNumeric(palette = "YlOrRd",
                    domain = df$pop)

leaflet(data = df) %>%
    addTiles() %>%
    addCircleMarkers(lat = ~lat, lng = ~long, popup = ~name, 
                     color = ~pal(pop), stroke = FALSE, fillOpacity = 0.6) %>%
    addLegend(position = "bottomleft", pal = pal, values = ~pop)

enter image description here

What am I missing here?

chris
  • 155
  • 2
  • 3
  • 17
  • Try replacing `addTiles()` with `addProviderTiles` – UseR10085 Apr 20 '20 at 10:28
  • It gave me an error: Error in invokeMethod(map, getMapData(map), "addProviderTiles", provider, : argument "provider" is missing, with no default. Amy idea what the provider argument might be – chris Apr 20 '20 at 10:31
  • Are you behind any proxy? – UseR10085 Apr 20 '20 at 10:57
  • Not really an answer to my question but I found another complaint somewhere - seems to be an RStudio Desktop issue instead of a leaflet issue. Tried several providers for that argument. The complaint I found suggested using "Esri". I now get an outline and decent map. I'm just not sure how / when / if the supposed bug will be resolved so the code in my question works on the latest version of RStudio – chris Apr 20 '20 at 10:59
  • Nope, not behind a proxy – chris Apr 20 '20 at 11:00

0 Answers0