This is a map of current Major League Baseball Stadiums, illustratting the exact location of teams’ home stadium. This encompasses both major and minor leagues for USA baseball.

The data was originally sourced from this URL and fetched into a stadiums file.

http://www.seamheads.com/ballparks/index.php

#install.packages("readxl")
library(readxl)
stadiums<-read_excel("Parks.xlsx")

Because of population and team distribution, some stadiums overlap one-another at large scales (for example New York City). To make it easier to visualize the locations, overlapping stadiums are clustered.

library(leaflet)
stadname <- stadiums[,2]
stadcity <- stadiums[,3]
stadstate <- stadiums [,4]

tagspops <- cbind(stadname,stadcity,stadstate, sep = "<br>")

icons <- makeIcon(iconUrl = "stadiumicon.png",
                 iconWidth = 40, iconHeight = 40,
                 iconAnchorX = 20, iconAnchorY = 20)

map <- leaflet() %>%
  addTiles() %>%
  addMarkers(popup = tagspops, icon = icons,
             clusterOptions = markerClusterOptions(),
             lat = stadiums$Latitude, lng = stadiums$Longitude)

map