CRDC_Large_Query: Large Query Request from Civil Rights Documentation...

Description Usage Arguments Details Examples

Description

This function allows a user to make a query request from the CRDC APIs. This is the large query function and returns any number of specified page results (or all pages) with per page results limited at 10,000.

Usage

1
2
3
CRDC_Large_Query(dataset = "enrollment", api_key = Sys.getenv("TOKEN"),
  per_page = "10000", sort = "LEAID", page = 1, numpages = NULL,
  preprocess = T, vars = NULL)

Arguments

dataset

This parameter is a string that can take one of two values to specify which dataset the user wants to query. The options are "enrollment" and "suspension". The parameter defaults to "enrollment".

api_key

This parameter a string representing the required api key to query the CRDC APIs. By default it is set to Sys.getenv("TOKEN"). Either replace with your user api key or specify in your Renviron file. API keys can be obtained at https://usedgov.github.io/key/.

per_page

This parameter is string representing the number of results per page you would like to see. This can be thought of as the number of observations that will be returned. By default it is set to 1000.

sort

This parameter is a string that allows the user to control how the output is sorted. By default this parameter is set to LEAID.

page

This parameter is a number representing which page of the results will be returned. By default this parameter is set to 1.

numpages

This parameter is a number that allows the user to specify how many pages of results the user would like returned. The default is set to NULL, therefore the query returns all pages.

preprocess

This parameter is a logical which allows the user to turn on the optional preprocessing component of the function. By default this value is set to True.

vars

This parameter is a character vector that allows the user to select which variables from the query he/she would like returned. By defaul this parameter is set to NULL.

Details

The function asks the user to define a set of function parameters (See arguements). The Civil Rights Documentation Collection APIs contain two datasets. The school enrollment 2013-14 dataset and the out-of-school suspensions 2013-14 datasets. The datasets themselves are quite large, and during preliminary exploration users may only want a small subset of the data. This function allows for large batch queries to be sent to the CRDC APIs.

Examples

1
2
3
4
5
6
7
CRDC_data <- CRDC_Large_Query()

CRDC_data <- CRDC_Large_Query(dataset = "suspension", per_page = "10000")

CRDC_data <- CRDC_Large_Query(page = 2, vars = c("LEA_STATE","COMBOKEY","LEAID"))

CRDC_data <- CRDC_Large_Query(dataset = "enrollment", numpages = 2, preprocess = FALSE)

kpersauddavis/rCRDC documentation built on May 6, 2019, 4:33 p.m.