Package 'readapra'

Title: Download and Tidy Data from the Australian Prudential Regulation Authority
Description: Download the latest data from the Australian Prudential Regulation Authority <https://www.apra.gov.au/> and import it into R as a tidy data frame.
Authors: Jarrod van der Wal [aut, cre, cph]
Maintainer: Jarrod van der Wal <[email protected]>
License: MIT + file LICENSE
Version: 0.2.1
Built: 2025-02-23 01:45:49 UTC
Source: https://github.com/javanderwal/readapra

Help Index


Statistical Publications Produced by APRA

Description

This dataset contains a record of all statistical publications produced by APRA that are available in readapra.

Usage

apra_stat_pubs

Format

A data frame with 7 rows and 3 variables:

stat_pub_name

the full name of the statistical publication.

stat_pub_acronym

the acronym of the statistical publication.

cur_hist

available current and historical versions of the statistical publication.


Download a Statistical Publication File from APRA's Website

Description

Download a statistical publication file from APRA's website. By default files are saved to a temporary directory.

Usage

download_apra(
  stat_pub,
  cur_hist = "current",
  path = tempdir(),
  overwrite = TRUE,
  quiet = FALSE,
  ...
)

Arguments

stat_pub

character vector detailing a statistical publication to be downloaded. Must match a valid value in the apra_stat_pubs_acronym variable of the apra_stat_pubs dataset.

cur_hist

character vector detailing whether to download a current or historic statistical publication. Must match a valid value in the cur_hist variable of the apra_stat_pubs dataset.

path

path to where the downloaded file should be saved. Uses base::tempdir() by default.

overwrite

whether to overwrite a previously downloaded statistical publication file when re-running this function.

quiet

whether to suppress the download progress bar.

...

additional arguments to be passed to utils::download.file().

Value

A character vector detailing the file path to the downloaded file.

Examples

# Download a statistical publication file:
download_path <-
  download_apra(stat_pub = "qadips", cur_hist = "current")

# View the file path of the statistical publication file:
print(download_path)

Read APRA's Statistical Publications

Description

Download and import a specific statistical publication produced by APRA.

Please consult the apra_stat_pubs dataset to see which of APRA's statistical publications are available in readapra.

Usage

read_apra(
  stat_pub,
  cur_hist = "current",
  path = tempdir(),
  quiet = FALSE,
  overwrite = TRUE,
  ...
)

Arguments

stat_pub

character vector detailing a statistical publication to be downloaded and imported. Must match a valid value in the apra_stat_pubs_acronym variable of the apra_stat_pubs dataset.

cur_hist

character vector detailing whether to download and import a current or historic statistical publication. Must match a valid value in the cur_hist variable of the apra_stat_pubs dataset.

path

path to where the downloaded file should be saved. Uses base::tempdir() by default.

quiet

whether to suppress the download progress bar.

overwrite

whether to overwrite a previously downloaded statistical publication file when re-running this function.

...

additional arguments to be passed to utils::download.file().

Value

A tibble containing the statistical publication data.

Examples

# Download and import the current MADIS data:
current_madis_data <-
  read_apra(stat_pub = "madis", cur_hist = "current")

# Examine the current MADIS data:
print(current_madis_data)

Read APRA Publication Statistics Locally

Description

Import from a local file a specific statistical publication produced by APRA.

Please consult the apra_stat_pubs dataset to see which of APRA's statistical publications are available in readapra.

Usage

read_apra_local(file_path, stat_pub, cur_hist = "current")

Arguments

file_path

path to the local file from which the statistical publication data will be imported.

stat_pub

character vector detailing a statistical publication to be imported. Must match a valid value in the apra_stat_pubs_acronym variable of the apra_stat_pubs dataset.

cur_hist

character vector detailing whether to import a current or historic statistical publication. Must match a valid value in the cur_hist variable of the apra_stat_pubs dataset.

Value

A tibble containing the statistical publication data.

Examples

# Download the current MADIS data and get the file path:
current_madis_file_path <-
  download_apra(stat_pub = "madis", cur_hist = "current")

# Import the current MADIS data:
current_madis_data <-
  read_apra_local(
    stat_pub = "madis",
    cur_hist = "current",
    file_path = current_madis_file_path
  )

# Examine the current MADIS data:
print(current_madis_data)