sc_year error when trying to access prior year's data
I am able to create a dataframe with the current year's data using this code
dt00_sc_debt_19 <- sc_init() %>%
sc_filter(unitid == dt00_sc_peers[,3]) %>%
sc_select(unitid, instnm, stabbr, ugds, grad_debt_mdn, cdr3) %>%
sc_year("latest") %>%
sc_get(key_get("scorecard", "sc_key"))
However, if I change the sc_year variable to a prior year, e.g., '2017'
dt00_sc_debt_17 <- sc_init() %>%
sc_filter(unitid == dt00_sc_peers[,3]) %>%
sc_select(unitid, instnm, stabbr, ugds, grad_debt_mdn, cdr3) %>%
sc_year(2017) %>%
sc_get(key_get("scorecard", "sc_key"))
I get the following error:
Error: lexical error: invalid char in json text.
<html> <head><title>502 Bad Ga
(right here) ------^
Any assistance you can provide is greatly appreciated.
That's bad error handling on my part, so I'll add that to the queue of fixes.
I'll investigate more when I have the time, but errors like this often mean a data element isn't available in a given year. If that's the case, that would help explain why the code works for the "latest" data, but not in 2017. Alternately drop grad_debt_mdn and cdr3 with the second call to see if it works.
Thank you. I appreciate your time in looking into this further. I think it was working fine about six months ago. I'll test it with the modifications that you suggested.
I added some more error handling, so you might install the latest release (v0.19.1) and try again. I can't run your code myself because I don't have access to dt00_sc_peers[,3].