#Developing Data Products This Markdown document aims to show on a map the first 8 Listed US Companies by Market Cap on an US Map; We will start by importing the libraries needed:
library(leaflet)
Then we create a dataframe, to hold the data we want to show on the map
Company <- c('Microsoft','Apple','Amazon','Alphabet','Berkshire Hathaway','Facebook','Johnson & Johnson','Exxon Mobil')
HQAddress <-('')
MarketCap <- c(904.86, 895.67, 874.71,818.16,493.75,475.73,372.23,342.17)
lat <- c(47.6493198, 37.33, 47.61,37.422,41.25,37.45,40.486, 32.49)
lng <- c(237.8658351236, 238, 237.67,237.916,264,237.82,74.44, 96.57)
df <- data.frame(Company, MarketCap,lat,lng)
map <- df %>%
leaflet() %>%
addTiles() %>%
setView(41.25, 264, zoom = 4) %>%
addCircleMarkers(df$lng, df$lat, radius = df$MarketCap/100, popup=paste("Company:", df$Company, "<br>",
"Market Cap:", df$MarketCap)) %>%
addLegend("bottomright", colors= "#13ED3F", labels="Starbucks", title="Top 8 US Companies by Market Cap (Headquarters)")
map