Instructions

Create a web page using R Markdown that features a map created with Leaflet.Host your webpage on either GitHub Pages, RPubs, or NeoCities. Your webpage must contain the date that you created the document, and it must contain a map created with Leaflet. We would love to see you show off your creativity!

Problem

I wanted to investigate the amount of McDonald’s stores in central phoenix. For this purpose a search was perfomed using maps application. Following we developed a data frame with the latittude and longitude coodinates for each of the stores.I extracted the most central and top 40 results.

## # A tibble: 6 x 2
##     lat   lng
##   <dbl> <dbl>
## 1  33.5 -112.
## 2  33.5 -112.
## 3  33.5 -112.
## 4  33.5 -112.
## 5  33.5 -112.
## 6  33.5 -112.

Data

With the data first we create the icons and then we render the map

mcdonaldsicon <- makeIcon(
  iconUrl = "https://www.pinclipart.com/picdir/big/368-3688927_mcdonalds-logo-png-mcdonalds-logo-png-clipart.png",
  iconWidth = 35, iconHeight = 40,
  iconAnchorX = 30, iconAnchorY = 30
)

mcdonaldsmap <- mcdonalds

mcdonaldsmap %>%
  leaflet() %>%
  addProviderTiles(providers$OpenStreetMap.Mapnik) %>%
  fitBounds(-112.196160, 33.483459,-111.934523,33.483349) %>%
  addMarkers(icon=mcdonaldsicon)

Conclusions

Quite a lot huh! And round central phoenix there are way more!