library(rscorecard)

Using area within zip code

## public schools within 50 miles of midtown Nashville, TN
df <- sc_init() %>% 
    sc_filter(control == 1) %>% 
    sc_select(unitid, instnm, stabbr) %>% 
    sc_year(2013) %>% 
    sc_zip(37203, 50) %>%
    sc_get()
#> Request complete!
df
#> # A tibble: 10 x 4
#>    unitid instnm                                               stabbr  year
#>     <int> <chr>                                                <chr>  <dbl>
#>  1 219602 Austin Peay State University                         TN      2013
#>  2 219888 Columbia State Community College                     TN      2013
#>  3 248925 Tennessee College of Applied Technology Nashville    TN      2013
#>  4 221102 Tennessee College of Applied Technology-Murfreesboro TN      2013
#>  5 220978 Middle Tennessee State University                    TN      2013
#>  6 221838 Tennessee State University                           TN      2013
#>  7 219994 Tennessee College of Applied Technology-Dickson      TN      2013
#>  8 221184 Nashville State Community College                    TN      2013
#>  9 222053 Volunteer State Community College                    TN      2013
#> 10 220279 Tennessee College of Applied Technology-Hartsville   TN      2013

Large pull

The College Scorecard will only return 100 results at a time. When there are more than 100 results, the package will make multiple pulls and append all results before returning.

## median earnings for students who first enrolled in a public
## college in the New England or Mid-Atlantic regions: 10 years later
df <- sc_init() %>% 
    sc_filter(control == 1, region == 1:2, ccbasic == 1:24) %>% 
    sc_select(unitid, instnm, md_earn_wne_p10) %>% 
    sc_year(2009) %>%
    sc_get()
#> Large request will require: 2 additional pulls.
#> Request chunk 1
#> Request chunk 2
#> Request complete!
df
#> # A tibble: 280 x 4
#>    unitid instnm                                    md_earn_wne_p10  year
#>     <int> <chr>                                               <int> <dbl>
#>  1 161077 Central Maine Community College                     33800  2009
#>  2 163204 University of Maryland-University College           52100  2009
#>  3 161554 University of Southern Maine                        36700  2009
#>  4 161217 University of Maine at Augusta                      28900  2009
#>  5 162584 Frostburg State University                          45500  2009
#>  6 161244 University of Maine at Machias                      28300  2009
#>  7 162104 Cecil College                                       34300  2009
#>  8 161581 Washington County Community College                 24500  2009
#>  9 161767 Anne Arundel Community College                      41800  2009
#> 10 161864 Baltimore City Community College                    31000  2009
#> # … with 270 more rows