Title: | Download and Tidy Data from the Reserve Bank of Australia |
---|---|
Description: | Download up-to-date data from the Reserve Bank of Australia in a tidy data frame. Package includes functions to download current and historical statistical tables (<https://www.rba.gov.au/statistics/tables/>) and forecasts (<https://www.rba.gov.au/publications/smp/forecasts-archive.html>). Data includes a broad range of Australian macroeconomic and financial time series. |
Authors: | Matt Cowgill [aut, cre] , Angus Moore [ctb] |
Maintainer: | Matt Cowgill <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.11.900 |
Built: | 2024-11-16 22:21:41 UTC |
Source: | https://github.com/mattcowgill/readrba |
Use these functions to find the table number or series ID of the data you're interested in.
browse_rba_series(search_string = "") browse_rba_tables(search_string = "", refresh = FALSE)
browse_rba_series(search_string = "") browse_rba_tables(search_string = "", refresh = FALSE)
search_string |
Word or phrase to search for, such as "gold" or "commodity" or "labour".
If left as |
refresh |
logical; |
A data.frame
(tbl_df
) containing RBA data series/tables that match the search_string
.
Where no search_string
is supplied, the data.frame will contain information
about all RBA series/tables.
The data.frame returned by browse_rba_tables()
includes a column called
readable
. This column takes the value TRUE
if the table is able to be
read by read_rba()
and FALSE
if it cannot be read.
# Find series that contain 'unemployment' browse_rba_series("unemployment") # Or all labour-related series browse_rba_series("labour") # Or those related to commodities browse_rba_series("commodities") # Or all series browse_rba_series() # Or just look for tables that contain the word 'labour' browse_rba_tables("labour") # Or all tables browse_rba_tables() # To re-scrape the RBA website to ensure you have up-to-date information # about available tables: ## Not run: browse_rba_tables(refresh = TRUE) ## End(Not run)
# Find series that contain 'unemployment' browse_rba_series("unemployment") # Or all labour-related series browse_rba_series("labour") # Or those related to commodities browse_rba_series("commodities") # Or all series browse_rba_series() # Or just look for tables that contain the word 'labour' browse_rba_tables("labour") # Or all tables browse_rba_tables() # To re-scrape the RBA website to ensure you have up-to-date information # about available tables: ## Not run: browse_rba_tables(refresh = TRUE) ## End(Not run)
Compile the RBA's public forecasts of key economic variables over time
rba_forecasts( refresh = TRUE, all_or_latest = c("all", "latest"), remove_old = TRUE ) read_forecasts(...)
rba_forecasts( refresh = TRUE, all_or_latest = c("all", "latest"), remove_old = TRUE ) read_forecasts(...)
refresh |
logical; default is |
all_or_latest |
character; default is |
remove_old |
logical; default is |
... |
Arguments passed to |
Forecasts are not available for all series on all forecast dates. CPI inflation and GDP growth are included in all forecasts. The unemployment rate is included in most forecasts. Other series are included inconsistently, based on their availability in the underlying source data.
All forecasts issued on or before November 2014 come from Tulip and Wallace (2012), RBA RDP2012-07. Data available: https://www.rba.gov.au/statistics/historical-forecasts.html.
Data from 2015 to August 2018 are scraped from the RBA's quarterly Statement on Monetary Policy (https://www.rba.gov.au/publications/smp/2020/aug/). Note from from Feb 2015 to August 2018 (inclusive) only include a few series; those from November 2018 onwards include more series.
Data from November 2018 to present comes from the published 'Forecasts Archive' file on the RBA website (https://www.rba.gov.au/publications/smp/forecasts-archive.html).
read_forecasts()
is a wrapper around rba_forecasts()
.
A tidy tbl_df
containing 8 columns:
forecast_date
The (approximate) date on which the forecast was published. Note that this is the first day of the publication month, so the forecast_date
for forecasts in the February 2020 Statement on Monetary Policy is as.Date("2020-02-01")
.
date
The date to which the forecast pertains. Note that this is the first day of the final month of the relevant quarter. For example, a forecast of GDP in the June quarter 2021 will be as.Date("2021-06-01")
.
year_qtr
The year and quarter to which the forecast pertains, such as 2019.1.
series
Short, snake_case description of the data series being forecast, such as gdp_change
or unemp_rate
. These are consistent over time.
value
The forecast value, in per cent. For example, if GDP growth is forecast to be 3 per cent, the value will be 3
. Note that where a forecast is given as a range (eg. 3.5-4.5%) the value
will be the midpoint of the range (eg. 4%).
series_desc
Full description of the series being forecast, as per the RBA website, such as "Real household disposable income". Note that series descriptions are not necessarily consistent over time; the values here are those published by the RBA. The series
column is consistent over time.
source
For recent forecasts, this is 'SMP', meaning the RBA's Statement on Monetary Policy. Forecasts prior to 2014 are sourced from various places; see Details
.
notes
Notes accompanying the forecasts, as per the RBA's website. Note these are identical for item in a given forecast_date
.
forecasts <- read_forecasts()
forecasts <- read_forecasts()
Convenience function to get the RBA's cash rate.
read_cashrate(type = c("target", "interbank", "both")) rba_cashrate(...)
read_cashrate(type = c("target", "interbank", "both")) rba_cashrate(...)
type |
One of
|
... |
arguments passed to |
Note that in the very early 1990s, the cash rate target was
expressed as a range (eg. "17% to 17.5%"). Where this is the case,
the value returned here (and in read_rba()
) is the mid-point of this range.
If type = 'both'
, note that the returned tbl is tidy/long.
rba_cashrate()
is a wrapper around read_cashrate()
.
A tbl_df
with two columns: date
and cash_rate
.
Download, import, and tidy statistical tables from the RBA
read_rba( table_no = NULL, cur_hist = "current", series_id = NULL, path = tempdir(), update_urls = FALSE ) read_rba_seriesid(series_id, path = tempdir())
read_rba( table_no = NULL, cur_hist = "current", series_id = NULL, path = tempdir(), update_urls = FALSE ) read_rba_seriesid(series_id, path = tempdir())
table_no |
Character vector of table number(s),
such as |
cur_hist |
Character; valid values are |
series_id |
Optional, character. Specifying Supply unique RBA time series identifier(s).
For example, "GCPIAG" is the identifier for the CPI, so Note that |
path |
Directory in which to save downloaded RBA Excel file(s).
Default is |
update_urls |
Logical; default is Must be either a vector of either length 1 (eg. "
|
read_rba()
downloads, imports and tidies data from statistical
tables published by the Reserve Bank of Australia. You can specify the
requested data using the table_no
or series_id
.
To find the table_no
or series_id
that corresponds to the data you want,
use the functions browse_rba_tables()
and/or browse_rba_series()
. Note
that some historical exchange rate tables do not have table numbers on
the RBA website; they have been assigned table numbers -
see browse_rba_tables("exchange rates").
To see which tables cannot currently be read, run browse_rba_tables(FALSE)
.
read_rba_seriesid()
is a wrapper around read_rba()
.
Certain corporate networks restrict your ability to download files in an R
session. On some of these networks, the "wininet"
method must be used when
downloading files. Users can specify the method that will be used to
download files by setting the "R_READRBA_DL_METHOD"
environment variable.
For example, the following code sets the environment variable for your
current session: Sys.setenv("R_READRBA_DL_METHOD" = "wininet")
You can add "R_READRBA_DL_METHOD"
to your .Rprofile to have this
persist across sessions.
A single tidy tibble containing the requested table(s)
## Not run: # Get a single table: read_rba(table_no = "a1.1") # Get multiple tables, combined in a tidy tibble: read_rba(table_no = c("a1.1", "g1")) # Get both the current and historical versions of a table read_rba(table_no = c("a1.1", "a1.1"), cur_hist = c("current", "historical")) # Get data based on the series ID: read_rba(series_id = "GCPIAG") # Or, equivalently, use: read_rba_seriesid("GCPIAG") # Get multiple series IDs: read_rba(series_id = c("GCPIAG", "GCPIAGSAQP")) ## End(Not run)
## Not run: # Get a single table: read_rba(table_no = "a1.1") # Get multiple tables, combined in a tidy tibble: read_rba(table_no = c("a1.1", "g1")) # Get both the current and historical versions of a table read_rba(table_no = c("a1.1", "a1.1"), cur_hist = c("current", "historical")) # Get data based on the series ID: read_rba(series_id = "GCPIAG") # Or, equivalently, use: read_rba_seriesid("GCPIAG") # Get multiple series IDs: read_rba(series_id = c("GCPIAG", "GCPIAGSAQP")) ## End(Not run)
Load and tidy local RBA Excel sheets
read_rba_local(filenames, series_id = NULL)
read_rba_local(filenames, series_id = NULL)
filenames |
Vector of filename(s) (with path) pointing to local RBA Excel sheets |
series_id |
Optional series ID |
A tbl_df
containing tidied RBA Excel sheet(s)
## Not run: read_rba_local("data/rba_file.xls") ## End(Not run)
## Not run: read_rba_local("data/rba_file.xls") ## End(Not run)
Tidy a statistical table from the RBA
tidy_rba(excel_sheet, series_id = NULL)
tidy_rba(excel_sheet, series_id = NULL)
excel_sheet |
Dataframe of RBA spreadsheet. |
series_id |
Optional series ID |
Tidy tibble