Make the leaflet and readr packages available.
library(leaflet)
library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.0 --
## v ggplot2 3.3.3 v purrr 0.3.4
## v tibble 3.0.6 v dplyr 1.0.4
## v tidyr 1.1.2 v stringr 1.4.0
## v readr 1.4.0 v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
Rerun the code from Problem 2 in the previous assignment.
myLocs <- read_csv("myLocs.csv")
##
## -- Column specification --------------------------------------------------------
## cols(
## lat = col_double(),
## lon = col_double(),
## ID = col_character()
## )
myMap = myLocs %>%
leaflet() %>%
addTiles() %>%
addMarkers(popup = ~ID)
## Assuming "lon" and "lat" are longitude and latitude, respectively
myMap
Rerun the code again with a different provider’s tiles.
myMap = myLocs %>%
leaflet() %>%
addProviderTiles(providers$Esri.NatGeoWorldMap)%>%
addMarkers(popup = ~ID)
## Assuming "lon" and "lat" are longitude and latitude, respectively
myMap
Do that again with a different provider.
myMap = myLocs %>%
leaflet() %>%
addProviderTiles(providers$CartoDB.Positron)%>%
addMarkers(popup = ~ID)
## Assuming "lon" and "lat" are longitude and latitude, respectively
myMap
Which provider looks best to you? No code, just write.
The default provider looks best to me. It is because there are more detailed layers on the default that differentiate some of the map features distinctively more than the other 2 provider tiles.