Title: | Builds Queries And Retrieves Data From DWP Stat-Xplore |
---|---|
Description: | Relatively user-friendly approach to formulating queries to the Stat-Xplore API, and handling the response. |
Authors: | Fran Barton |
Maintainer: | Fran Barton <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.4.7 |
Built: | 2024-11-18 05:25:13 UTC |
Source: | https://github.com/francisbarton/xstatic |
xstatic
xstatic( ben, area_codes = NULL, filter_level = NULL, filter_area = ".*", return_level, area_code_lookup = NULL, geo_level = NULL, chatty = TRUE, ... )
xstatic( ben, area_codes = NULL, filter_level = NULL, filter_area = ".*", return_level, area_code_lookup = NULL, geo_level = NULL, chatty = TRUE, ... )
ben |
name of a benefit dataset on Stat-Xplore (partial/regex works) |
area_codes |
(optional) provide your own vector (list) of area codes for the query (don't use built-in lookup) |
filter_level |
return data within an area at this level |
filter_area |
return data within this area. defaults to ".*" (all) |
return_level |
return data at this level |
area_code_lookup |
use this source to lookup area codes at return_level within filter_area |
geo_level |
If for some reason you need to pass a return_level that is different from the standard options, you will also need to pass a geo_level - an integer between 1 and 7, where 1 means "OA" and 7 refers to "country" |
chatty |
TRUE by default. Provides verbose commentary on the query process. |
... |
space to pass parameters to the helper function get_dwp_codes, mainly to do with the number of recent periods (months or quarters) to retrieve data for: provide 'periods_tail = n' (uses 1 - just return most recent period - by default); see also 'periods_head'; you can also tweak the query away from the default of Census geographies to Westminster constituencies, for example, where available, by providing a different value for 'geo_type'; you can also change the subset of data from the default by providing a different value for 'ds'. |
A data frame
xstatic( ben = "^Carers", filter_level = "lad", # case-insensitive filter_area = "City of London", # case sensitive return_level = "MsOa", # case-insensitive periods_tail = 2, # starting with most recent available month/quarter periods_head = 1, # returns penultimate data period only (ie first 1 of 2) chatty = FALSE)
xstatic( ben = "^Carers", filter_level = "lad", # case-insensitive filter_area = "City of London", # case sensitive return_level = "MsOa", # case-insensitive periods_tail = 2, # starting with most recent available month/quarter periods_head = 1, # returns penultimate data period only (ie first 1 of 2) chatty = FALSE)
Xplore the Stat-Xplore API interactively
xstatic_interactive()
xstatic_interactive()