CRDC_Query: Standard 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 standard query function and only returns the first page of results limited to 10,000 observations.

Usage

1
2
3
CRDC_Query(dataset = "enrollment", api_key = Sys.getenv("TOKEN"),
  per_page = "1000", sort = "LEAID", page = 1, 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.

preprocess

This parameter is a logical which allows the user to turn on the optional preprocessing component of the function including converting the query result into a dataframe. 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 default 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 small batch queries to be sent to the CRDC APIs.

Examples

1
2
3
4
5
CRDC_data <- CRDC_Query()

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

CRDC_data <- CRDC_Query(dataset = "enrollment", page = 2, vars = c("LEA_STATE","COMBOKEY","LEAID"))

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