The institution dataset is obtained from ed.gov. MERGED2015_16_CA_JC.csv referenced in the following code chunk is a subset of MERGED2015_16_PP.csv, the 2015-16 College Scorecard dataset, filtered on the following criteria:
ST = "CA" & PREDDEG = 1 or 2 (certificate or associate's degree institutions)
scCAJC = read.csv("MERGED2015_16_CA_JC.csv",na.strings="NULL")
cmplCAJC = scCAJC %>%
filter(as.numeric(substr(ZIP,1,5))<93000) %>% # only SoCal institutions
select(UNITID, INSTNM, INSTURL, ZIP, C150_L4, LATITUDE, LONGITUDE, PREDDEG)
nameURL = paste("<a href='http://",cmplCAJC$INSTURL,"'>",cmplCAJC$INSTNM,"</a>",sep="")
popupText = paste(nameURL, '<BR>',
ifelse(cmplCAJC$PREDDEG==1,"Predominant Degree Awarded: Certificate",
"Predominant Degree Awarded: Associate's"), '<BR>',
'Completion Rate:',
as.character(cmplCAJC$C150_L4*100),'%',
sep="")
# reference: http://rstudio.github.io/leaflet/
library(leaflet)
latLA = 34.0522; lngLA = -118.2437
binpal = colorBin(c("tomato","dodgerblue"),cmplCAJC$PREDDEG,2,pretty=FALSE)
CAJC_map = cmplCAJC %>% leaflet() %>%
setView(lat = latLA, # the lat of the center of the map
lng = lngLA, # the lng of the center of the map
zoom=11) %>%
addProviderTiles((providers$Esri.NatGeoWorldMap)) %>%
addCircles(
lat = cmplCAJC$LATITUDE,
lng = cmplCAJC$LONGITUDE,
weight = 1,
#radius = (cmplCAJC$C150_L4) *100*10,
radius = 1000,
color = binpal(cmplCAJC$PREDDEG),
popup = popupText
)
CAJC_map