There are 39,198 McDonald’s in the world and this map shows you which countries have them and how many each owns. The data used can be found here which is from Dec 2020.
The data from McDonald’s was in a report so I cleaned it up with some regex and deleting the fluff to get it to clean usable data. I then found a csv file that contained a list of all countries and their long and latitudes. Then I merge the 2 on country so now I have a DF that has country name, count of McDonald’s, and their long/lat.
Country <- read.csv("Countries.csv")
MCD <- read_excel("mcdonalds.xlsx")
Data <- merge(MCD, Country, by = "Country")MCD_Icon <- makeIcon(iconUrl="https://cdn4.iconfinder.com/data/icons/social-media-logos-6/512/86-mcdonalds-512.png",
iconWidth = 25, iconHeight = 25)
Data %>%
leaflet(width="100%") %>%
addTiles() %>%
addMarkers(icon = MCD_Icon, popup = ~as.character(Count), label = ~as.character(Country),
clusterOptions=markerClusterOptions())In this project count of McDonald’s was displayed using Leaflet, one of the most popular Javascript libraries for creating interactive maps. However, in only a few lines of code, the leaflet R package allowed the creation of my own leaflet map without needing to know any Javascript!