#let's first create a tibble which we can use to join the ipeds data containing HBCU status and location information with out enrollment data
campus_ids <- tribble(
~campus, ~unitid, ~campus_short,
"App_State", 197869, "App State",
"East_Carolina", 198464, "ECU",
"Elizabeth_City_State", 198507, "ECSU",
"Fayetteville_State", 198543, "FSU",
"NC_Agricultural_and_Technical_State_University", 199102, "NC A&T",
"UNC_Asheville", 199111, "UNCA",
"UNC_Chapel_Hill", 199120, "UNC-CH",
"UNC_Charlotte", 199139, "UNCC",
"UNC_Greensboro", 199148, "UNCG",
"North_Carolina_Central_University", 199157, "NCCU",
"UNC_School_of_the_Arts", 199184, "UNCSA",
"NC_State_University", 199193, "NC State",
"UNC_Wilmington", 199218, "UNCW",
"UNC_Pembroke", 199281, "UNCP",
"Winston_Salem_State_University", 199999, "WSSU",
"Western_Carolina_University", 200004, "WCU"
)
#let's read the ipeds data into R
ipeds <- read_csv("data/ipeds_data_092426.csv", show_col_types = FALSE, name_repair = "unique_quiet") %>%
transmute(unitid = UnitID,
hbcu = if_else(`HBCU (HD2023)` == 1, "HBCU", "Non-HBCU"),
campus_fips = `COUNTYCD (HD2023)`,
campus_lat = `LATITUDE (HD2023)`,
campus_long = `LONGITUD (HD2023)`)
#let's add the ipeds unitid with enrollment data and the shortened campus name for easier analysis
enroll <- enroll %>%
left_join(campus_ids, by = "campus") %>%
select(-campus, campus = campus_short)
#let's also create a campuses dataset for the UNC universities using the ipeds dataset
campuses <- campus_ids %>%
transmute(unitid, campus = campus_short) %>%
left_join(ipeds, by = "unitid")
campuses