Description Usage Arguments Details Value Author(s) Examples
Information retrieval from ONS webservices
1 2 3 4 5 6 7 8 |
method |
the API specific method, e.g. "collections" |
context |
the API specific context, e.g. "Economic" |
api.key |
the API key |
api.param |
a list with parameters used to construct the query, see examples. |
dataset |
the dataset to download. |
query |
logical, return the query containing the download link. |
curl |
optional, |
data |
a data frame created with |
Retrieve information from ONS API in CSV format.
The main function creates an URL with with the specified parameters, retrieves the zip file, extracts a csv file that is read into R and returned as data frame. Additional functions convert the returned data frame to an xts object.
Bo Werth <bo.werth@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 | ## Not run:
onsAPI(method = "contexts", api.key = api.key)
onsAPI(method = "collections", context = "Economic", api.key = api.key)
## End(Not run)
## Within a group there is a series for each combination of dimension items in the segment. In a time series dataset there will be several observations within a series, but in the case of Census data there is only one time (Census Day 2011).
api.param <- list(context = "Census",
geog = "2011WARDH",
totals = "false",
apikey = "xPuqnMzZ01")
data.QS208EW <- onsAPI(api.param = api.param, dataset = "QS208EW")
data.QS104EW <- onsAPI(api.param = api.param, dataset = "QS104EW")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.