library(tidyverse)
library(sf)
library(leaflet)
The data I will be using comes from the Integrated Postsecondary Education Data System (IPEDS) database https://nces.ed.gov/ipeds/use-the-data. I will be using creating a leaflet map that shows where schools are in the United States.
IPEDS.r <- read_csv("Data/School_Data/Data_5-13-2021---270.csv")
IPEDS.US <- IPEDS.r %>%
filter(`Sector of institution (HD2018)` != 0, # The school is not administrative
`Sector of institution (HD2018)` <= 3, # The school is a 4 year school
`Institutional category (HD2018)` <= 3,# The school offers bachelors or higher
`Degree-granting status (HD2018)` == 1) #Gives Degrees
IPEDS.US <- IPEDS.US %>%
rename(SchoolName = `Institution Name`,
State = `State abbreviation (HD2018)`,
Longitude = `Longitude location of institution (HD2018)`,
Latitude = `Latitude location of institution (HD2018)`,
PercentAdmittedTotal = `Percent admitted - total (DRVADM2018_RV)`,
TotalPrice=`Total price for in-state students living off campus (not with family) 2018-19 (DRVIC2018)`) %>%
select(UnitID,SchoolName, State, Longitude, Latitude, PercentAdmittedTotal,TotalPrice)
IPEDS.US.sf<- st_as_sf(IPEDS.US, coords = c("Longitude","Latitude"), crs = 4269) #Geographic census NAD83
labels = paste(IPEDS.US$SchoolName, IPEDS.US$TotalPrice, sep="<br> Total Price: $")
IPEDS.US.sf %>%
leaflet() %>%
addTiles() %>%
addMarkers(popup=IPEDS.US.sf$TotalPrice , clusterOptions=markerClusterOptions(), label = lapply(labels, htmltools::HTML))
You can browse the schools and see the total cost of the schools. This is the price for instate students.