Setup

Problem Definition

  1. Create a web page using R Markdown that features a map created with Leaflet.
  2. Host your webpage on either GitHub Pages, RPubs, or NeoCities.
  3. Your webpage must contain the date that you created the document, and it must contain a map created with Leaflet.
library(leaflet)
library(sf)
library(mapview)
library(maps)
library(dplyr)

Read Data

Map <- read.csv('HW5dataset.csv')
head(Map)
caption=" A knitr Kable."

Here is the Structure of the Dataset:

str(Map)
## 'data.frame':    16 obs. of  3 variables:
##  $ Name: chr  "University of the Incarnate Word" "Our Lady of the Lake University " "Trinity University  " "Baptist University of the Americas  " ...
##  $ Lat : num  29.5 29.4 29.5 29.3 29.5 ...
##  $ Long: num  98.5 98.5 98.5 98.5 98.6 ...

tibble::data map The locations of colleges in San Antonio area

Map <- tibble::tribble(~Name, ~longitude, ~latitude,
                   "University of the Incarnate Word", -98.4677, 29.4675,
                   "Our Lady of the Lake University ", -98.5434, 29.4264,
                   "Trinity University  ", -98.4833, 29.4618,
                   "Baptist University of the Americas  ", -98.5412, 29.3429,
                   "The Art Institute of San Antonio  ", -98.5655, 29.5328,
                   "Christ Mission College  ", -98.7071, 29.5433,
                   "St. Mary's University  ", -98.5641,  29.4523,
                   "Oblate School of Theology ", -98.5031, 29.5055,
                   "Texas A&M University-San Antonio  ", -98.5247, 29.3043,
                   "The University of Texas at San Antonio", -98.6189,29.5827,
                   "The University of Texas Health Science Center at San Antonio",-98.5754,29.5075,
                   "Northeast Lakeview College  ",-98.3231,29.5458,
                   "Northwest Vista College  ",-98.7054,29.4716,
                   "San Antonio College ", -98.4960,29.4458,
                   "St Philip's College  ",-98.4547,29.4163,
                   "Palo Alto College  ",-98.5456,29.3229)

Map <- Map %>% 
  st_as_sf(coords = c("longitude", "latitude"), 
           crs = 4326)

leaflet(data = Map) %>% 
  addTiles()%>% 
  setView(lng=-98.4946,lat=29.4252,zoom=10) %>%
  flyTo(lng=-98.4946,lat=29.4252,zoom=10) %>%
  addMarkers(popup = ~Name)

Use Dataset Display Locations of Colleges in San Antonio Area

Map %>%
leaflet()%>%
  addTiles()%>% 
  setView(lng=-98.4946,lat=29.4252,zoom=10) %>%
  flyTo(lng=-98.4946,lat=29.4252,zoom=10) %>%
  addCircles(data=Map, radius=800, color="#d95f0e", stroke=FALSE, fillOpacity=2, popup = ~Name) 

Conclusion

In this project San Antonio area colleges locations was displayed using Leaflet.