Skip to content

R wrapper for U.S. Department of Education College Scorecard Data API

License

Notifications You must be signed in to change notification settings

btskinner/rscorecard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rscorecard

Build Status GitHub release CRAN_Status_Badge

This package is an R wrapper for the U.S. Department of Education College Scorecard API. It allows users to select and filter Scorecard variables with piped commands a la dplyr.

Install

Install the latest released version from CRAN with

install.packages('rscorecard')

Install the latest development version from Github with

devtools::install_github('btskinner/rscorecard')

This package relies on the Scorecard data dictionary, so I will attempt to update it in a timely fashion whenever new Scorecard data are released. Because it sometimes takes a few days to get a package on CRAN, you may want to download the developmental version in the days immediately following a data update.

Dependencies

This package relies on the following packages, available in CRAN:

  • dplyr
  • jsonlite
  • lazyeval
  • magrittr

Example call

library(rscorecard)

df <- sc_init() %>% 
    sc_filter(region == 2, ccbasic == c(21,22,23), locale == 41:43) %>% 
    sc_select(unitid, instnm, stabbr) %>% 
    sc_year(2013) %>% 
    sc_get()
df

For more example calls, see the extended vignette.

Data dictionary

To look up information about data elements, use the sc_dict() function.

## search variable descriptions for those containing 'tuition'
sc_dict('tuition')

## search for variable names for those starting with 'st'
sc_dict('^st', search_col = 'varname')

## print entire dictionary (not recommended)
sc_dict('.', limit = Inf)

API key

Get your Data.gov API key at https://api.data.gov/signup/. Save your key in your R environment at the start of your R session using sc_key():

## use your real key in place of the Xs
sc_key('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')

Further references