Create a map of Grinnell College’s academic buildings and hyperlink them to their respective websites. This is a map created using the leaflet package in R.
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
# Creating a marker based on the openly sourced logo for Grinnell College
grinIcon <- makeIcon(
iconUrl = "https://upload.wikimedia.org/wikipedia/en/thumb/b/bc/Grinnell_College_seal.svg/1200px-Grinnell_College_seal.svg.png",
iconWidth = 31*215/230, iconHeight = 31,
iconAnchorX = 31*215/230/2, iconAnchorY = 16
)
# Creating a list of websites that redirect to Grinnell College
grinSites <- c(
"<a href ='https://www.grinnell.edu/'>Grinnell College</a>",
"<a href ='https://www.grinnell.edu/about/visit/spaces/alumni-recitation-hall-arh'>Alumni Recitation Hall (ARH)</a>",
"<a href ='https://www.grinnell.edu/about/visit/spaces/joe-rosenfield-%E2%80%9925-center'>Joe Rosenfield '25 Center (JRC)</a>",
"<a href ='https://www.grinnell.edu/about/visit/spaces/bucksbaum-center-arts'>Bucksbaum Center for the Arts</a>",
"<a href ='https://www.grinnell.edu/about/visit/spaces/charles-benson-bear-39-recreation-and-athletic-center'>Charles Benson Bear '39 Recreation & Athletic Center</a>",
"<a href ='https://www.grinnell.edu/about/visit/spaces/burling-library'>Burling Library</a>",
"<a href ='https://www.grinnell.edu/about/visit/spaces/mears-cottage'>Mears Cottage</a>",
"<a href ='https://www.grinnell.edu/about/visit/spaces/steiner-hall'>Steiner Hall</a>",
"<a href ='https://www.grinnell.edu/about/visit/spaces/goodnow-hall'>Goodnow Hall</a>",
"<a href ='https://www.grinnell.edu/about/visit/spaces/carnegie-hall'>Carnegie Hall</a>",
"<a href ='https://www.grinnell.edu/about/visit/spaces/forum'>Forum</a>",
"<a href ='https://www.grinnell.edu/about/visit/spaces/robert-n-noyce-%E2%80%9949-science-center'>Robert N. Noyce '49 Science Center</a>",
"<a href ='https://www.grinnell.edu/about/visit/spaces/harris-center'>Harris Center</a>"
)
# Subsetting points of interest (in this case, academic buildings at Grinnell College)
locations <- select(acad, lat, lng)
my_map <- locations %>%
leaflet() %>%
addTiles() %>% # Allows for basic map
addMarkers(icon = grinIcon, popup = grinSites, clusterOptions = markerClusterOptions()) # Adds markers onto map
my_map