datapull: Pull data from the Agnitio API

Description Usage Arguments Value Examples

View source: R/pull.R

Description

Pulls data from the Emsi Agnitio API according to specified parameters and returns a prepared data frame for analysis.

Usage

1
2
3
4
5
6
7
8
9
datapull(
  country,
  content,
  release,
  constraints,
  metrics,
  limiter = 20000,
  brake = 5
)

Arguments

country

The two-character country code.

content

The Emsi Agnitio dataset description (e.g. "Occupation").

release

The release or version identifier for the dataset (e.g. "2016.1").

constraints

A list of dimensional constraints relevant to the dataset, each of which has been prepared through dimmaker or CoW.

metrics

A set of metrics through which to quantify the data, prepared through metricmaker.

limiter

(optional) numerical limit on the dimensional size of your query, by default limited to 20,000 as the product of all the groups you're seeking to download - setting a higher number can make this work, but think about rationing or saving the result.

brake

(optional) changes the buffering time between queries to the API - default is set at 5 seconds, and if you're planning to hammer the API with lots of queries, it's good to have this at least, maybe more.

Value

A data frame of dimensions and metrics, with dimensions classified as factors and metrics as doubles.

Examples

1
2
3
4
5
6
met1 <- data.frame(names=c("Jobs.2016","Jobs.2022"), as=c("Jobs.2016","Jobs.2022"))
met1 <- metricmaker(met1)
area1 <- data.frame(name=c("Great Britain", "Wales"), code=c("GB", "WAL"))
areadim <- dimmaker("Area", area1)
occdim <- dimmaker("Occupation", data.frame(code="1"))
datapull("UK","Occupation","2016.1",list(CoW("A"),areadim,occsdim),met1)

dncnbrn/EmsiAgnitio documentation built on March 25, 2021, 7:31 a.m.