rscorecard icon indicating copy to clipboard operation
rscorecard copied to clipboard

sc_year error when trying to access prior year's data

Open UTexas80 opened this issue 4 years ago • 3 comments

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.

UTexas80 avatar Jul 07 '21 20:07 UTexas80

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.

btskinner avatar Jul 10 '21 14:07 btskinner

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.

UTexas80 avatar Jul 12 '21 12:07 UTexas80

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].

btskinner avatar Jul 15 '21 20:07 btskinner