fetch_data: Load data from the Government of India API.

Description Usage Arguments Value Examples

Description

fetch_data is the main function from this package to load the entire data set from the Government of India API.

Usage

1
2
fetch_data(res_id, filter = NULL, select = NULL, sort = NULL,
  field_type_correction = TRUE, max_obs = 500)

Arguments

res_id

a string, JSON data resource id

filter

a named vector, specifying equality constrainsts of the form "variable" = "condition"

select

a vector, specifying variables/fields to be selected

sort

a named vector, specifying sort order in the form "variable" = "order"

field_type_correction

boolean, whether to apply field type correction. All data fields are downloaded as character and then corrected (if at all) based on accompanying metadata

max_obs

an integer, specifying maximum no of observations to fetch (will be rounded UP to the nearest 100)

Value

list a list of 2 elements - data from the Government of India API, and metadata, additional information about the fields

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
### fetch a dataset using it's resource id and your personal API key
# Basic Use:
fetch_data(res_id = "60a68cec-7d1a-4e0e-a7eb-73ee1c7f29b7")

# Advanced Use, specifying additional parameters
fetch_data(res_id = "60a68cec-7d1a-4e0e-a7eb-73ee1c7f29b7"
           filter = c("state" = "Maharashtra"), 
           select = c("s_no_","constituency","state"),
           sort = c("s_no_" = "asc","constituency" = "desc"))

## End(Not run)

steadyfish/ogdindiar documentation built on May 30, 2019, 10:43 a.m.