Interactive Maps with leaflet in R
Rich Majerus
Vice President of Strategy & Planning, Queens University of Charlotte
leaflet() %>%
addProviderTiles("CartoDB") %>%
addMarkers(lng = dc_hq$lon, lat = dc_hq$lat, popup = dc_hq$hq)
m <- m %>%
setView(lat = 50.881363,
lng = 4.717863,
zoom = 5)
# Restore view based on
# data displayed on map
m %>%
clearBounds()
# Restore view based on
# data displayed on map
m %>%
clearBounds()
# Remove markers
m %>%
clearBounds() %>%
clearMarkers()
Integrated Postsecondary Education Data System (IPEDS)
Administered by National Center for Education Statistics (NCES)
Data from all institutions participating in federal student financial aid programs
> glimpse(ipeds)
Observations: 3,146
Variables: 5
$ name <chr> "A T Still University of Health Sciences",...
$ lng <dbl> -92.58918, -99.70954, -83.52828, -93.29968, ...
$ lat <dbl> 40.19365, 32.46915, 31.48189, 44.85621, 29.65008, ...
$ state <chr> "MO", "TX", "GA", "MN", "FL", "CA", "CA", "CA",...
$ sector_label <chr> "Private", "Private", "Public", "For-Profit", ...
ipeds %>% group_by(state) %>% count %>% arrange(desc(n))
# A tibble: 56 x 2
# Groups: state [56]
state n
<chr> <int>
1 CA 286
2 NY 239
3 PA 164
4 FL 160
5 TX 157
Interactive Maps with leaflet in R