get_api_data: Get data from API Index Name

Description Usage Arguments Value Examples

View source: R/key_func.R

Description

Using the API index name you got from the API Search/Discovery functions or from the API list available on data.gov.in, get the data in a convenient way parsed into a an R-friendly data frame.

Usage

1
2
3
4
5
6
7
get_api_data(
  api_index,
  results_per_req = "all",
  filter_by = c(),
  field_select = c(),
  sort_by = c()
)

Arguments

api_index

Index name of the API

results_per_req

Integer number of results to get per request ; "all" would get all the results

filter_by

A named character vector of field id (not the name) - value(s) pairs ; can take multiple fields as well as multiple comma separated values

field_select

A character vector of fields required in the final data frame

sort_by

A character vector of fields to sort by in the final data frame

Value

data.frame containing the queried data

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
register_api_key("api_key")

request_data<-get_api_data(api_index="3b01bcb8-0b14-4abf-b6f2-c1bfd384ba69",
     results_per_req=10,filter_by=c(state="Punjab,Haryana",
     district="Amritsar,Ludhiana"),
     field_select=c('state','district','city'),
     sort_by=c('state','district','city'))

## End(Not run)

datagovindia documentation built on Sept. 27, 2021, 5:12 p.m.