Overview of the RBNZ Package

  collapse = TRUE,
  comment = "#>"


This package provides a convenient way of accessing the financial and economic data published by the Reserve Bank of New Zealand (RBNZ) on their website, https://www.rbnz.govt.nz/statistics. The data is provided in .xlsx and .xls files; this package will download those files and read them into R. A summary of the available data can be found at the end of this document.

The author has no affiliation with the RBNZ. The copyright for the data can be found at https://www.rbnz.govt.nz/copyright.


The function for downloading the data is getSeries. This takes as its first argument the name of the series and will return a list containing the fields "meta" and "data" which are data frames containing the metadata and actual data, respectively. Each column of the "data" data frame corresponds to a row of the "meta" data frame (except the first which is "Date").


## Not evaluated in this vignette.
b1 <- getSeries('B1')

plot(b1$data$Date, b1$data$UK_pound_sterling, type = 'l')

Some of the datasets have different available formats. For example the B1 series contains exchange rate data in both daily and monthly form. The second argument of getSeries allows the user to specify which option they want, e.g. getSeries('B1', 'monthly').

Each series has a help file so typing, for example ?B1, will tell you what options, if any, are available.

For a full description of the arguments of getSeries, see the package manual.

Non-standard Data

The majority of the datasets available are all stored in a similar format, with data organised by date and a standard set of metadata. There are a few series that do not follow this template, as indicated below, and for these the spreadsheets are just downloaded and read into a list of data frames, one for each sheet, with no organising or cleaning.

Available Data

x <- RBNZ:::availableData()
for (ii in 1:nrow(x)){
  if (nchar(x[ii, 3]) > 50)
    x[ii, 3] <- paste0(substring(x[ii, 3], 1, 47), '...')
print(x, row.names = FALSE)

Try the RBNZ package in your browser

Any scripts or data that you put into this service are public.

RBNZ documentation built on July 28, 2020, 1:06 a.m.