These experimental functions provide a minimal interface to the ABS.Stat API.
More information on the ABS.Stat API can be found on the ABS website
Note that an ABS.Stat 'dataflow' is like a table. A 'datastructure' contains metadata that describes the variables in the dataflow. To load data from the ABS.Stat API, you need to either:
Using read_api_dataflows()
you can get information on the available dataflows
Using read_api_datastructure()
you can get metadata relating to a
specific dataflow, including the variables available in each dataflow
Using read_api()
you can get the data belonging to a given dataflow.
Using read_api_url()
you can get the data for a given query url
generated using the online data viewer.
read_api_dataflows()
read_api(
id,
datakey = NULL,
start_period = NULL,
end_period = NULL,
version = NULL
)
read_api_url(url)
read_api_datastructure(id)
A dataflow id. Use read_api_dataflows()
to obtain a dataframe
listing available dataflows.
A named list matching filter variables to codes. All variables
with a position
in the datastructure are filterable. Use
read_api_datastructure()
to obtain information about the variables in
a dataflow and the values of that variable.
The start period (used to filter by time). This is inclusive. The supported formats are:
"YYYY"
for annual data (e.g. 2019)
"YYYY-S[1-2]"
for semi-annual data (e.g. 2019-S1)
"YYYY-Q[1-4]"
for quarterly data (e.g. 2019-Q1)
"YYYY-MM[01-12]"
for monthly data (e.g. 2019-01)
"YYYY-W[01-53]"
for weekly data (e.g. 2019-W01)
"YYYY-MM-DD"
for daily and business data (e.g. 2019-01-01)
The end period (used to filter on time). This is inclusive.
The supported formats are the same as for start_period
A version number, if unspecified the latest version of the
dataset is used. Use read_api_dataflows()
to see
available dataflow versions.
A complete query url
A data.frame
Note that the API enforces a reasonably strict gateway timeout policy. This
means that, if you're trying to access a reasonably large dataset, you will
need to filter it on the server side using the datakey
. You might like to
review the data manually via the ABS website
to figure out what subset of the data you require.
Note, furthermore, that the datastructure contains a complete codebook for
the variables appearing in the relevant dataflow. Since some variables are
shared across multiple dataflows, this means that the datastructure
corresponding to a particular id
may contain values for a given variable
which are not in the corresponding dataflow.