Download and Tidy Time Series Data from the Australian Bureau of Statistics

Downloads, imports, and tidies time series data from the Australian Bureau of Statistics < https://www.abs.gov.au/>.


BuildStatus codecovstatus Project Status: Active – The project has reached a stable, usablestate and is being activelydeveloped. packageversion CRANstatus

Overview

readabs contains tools to easily download, import, and tidy time series data from the Australian Bureau of Statistics. This saves you time manually downloading and tediously tidying time series data and allows you to spend more time on your analysis.

readabs has changed. The package merged with getabs and readabs gained new functionality. Old readabs functions still work, but read_abs_data() is soft-deprecated.

We’d welcome Github issues containing error reports or feature requests. Alternatively you can email the package maintainer at mattcowgill at gmail dot com.

Installation

Install the latest CRAN version of readabs with:

install.packages("readabs")

You can install the developer version of readabs from GitHub with:

# if you don't have devtools installed, first run:
# install.packages("devtools")
devtools::install_github("mattcowgill/readabs")

Usage

There are two key functions in readabs. They are:

  • read_abs() downloads, imports, and tidies time series data from the ABS website.
  • read_abs_local() imports and tidies time series data from ABS spreadsheets stored on a local drive.

Both functions return a single tidy data frame (tibble) containing long data.

Examples

To download all the time series data from an ABS catalogue number to your disk, and import the data to R as a single tidy data frame, use read_abs(). Here’s an example with the Wage Price Index, catalogue number 6345.0:

library(readabs)
 
all_wpi <- read_abs("6345.0")
#> Finding filenames for tables from ABS catalogue 6345.0
#> Attempting to download files from cat. no. 6345.0, Wage Price Index, Australia
#> Extracting data from downloaded spreadsheets
#> Tidying data from imported ABS spreadsheets
 
str(all_wpi)
#> Classes 'tbl_df', 'tbl' and 'data.frame':    54261 obs. of  12 variables:
#>  $ table_no        : chr  "634501" "634501" "634501" "634501" ...
#>  $ sheet_no        : chr  "Data1" "Data1" "Data1" "Data1" ...
#>  $ table_title     : chr  "Table 1. Total Hourly Rates of Pay Excluding Bonuses: Sector, Original, Seasonally Adjusted and Trend" "Table 1. Total Hourly Rates of Pay Excluding Bonuses: Sector, Original, Seasonally Adjusted and Trend" "Table 1. Total Hourly Rates of Pay Excluding Bonuses: Sector, Original, Seasonally Adjusted and Trend" "Table 1. Total Hourly Rates of Pay Excluding Bonuses: Sector, Original, Seasonally Adjusted and Trend" ...
#>  $ date            : Date, format: "1997-09-01" "1997-12-01" ...
#>  $ series          : chr  "Quarterly Index ;  Total hourly rates of pay excluding bonuses ;  Australia ;  Private ;  All industries ;" "Quarterly Index ;  Total hourly rates of pay excluding bonuses ;  Australia ;  Private ;  All industries ;" "Quarterly Index ;  Total hourly rates of pay excluding bonuses ;  Australia ;  Private ;  All industries ;" "Quarterly Index ;  Total hourly rates of pay excluding bonuses ;  Australia ;  Private ;  All industries ;" ...
#>  $ value           : num  67.4 67.9 68.5 68.8 69.6 70 70.4 70.8 71.5 71.9 ...
#>  $ series_type     : chr  "Original" "Original" "Original" "Original" ...
#>  $ data_type       : chr  "INDEX" "INDEX" "INDEX" "INDEX" ...
#>  $ collection_month: chr  "3" "3" "3" "3" ...
#>  $ frequency       : chr  "Quarter" "Quarter" "Quarter" "Quarter" ...
#>  $ series_id       : chr  "A2603039T" "A2603039T" "A2603039T" "A2603039T" ...
#>  $ unit            : chr  "Index Numbers" "Index Numbers" "Index Numbers" "Index Numbers" ...

Maybe you only want a particular table? Here’s how you get a single table:

 
wpi_t1 <- read_abs("6345.0", tables = 1)
#> Finding filenames for tables from ABS catalogue 6345.0
#> Attempting to download files from cat. no. 6345.0, Wage Price Index, Australia
#> Extracting data from downloaded spreadsheets
#> Tidying data from imported ABS spreadsheets

If you want multiple tables, but not the whole catalogue, that’s easy too:

 
wpi_t1_t5 <- read_abs("6345.0", tables = c("1", "5a"))
#> Finding filenames for tables from ABS catalogue 6345.0
#> Attempting to download files from cat. no. 6345.0, Wage Price Index, Australia
#> Extracting data from downloaded spreadsheets
#> Tidying data from imported ABS spreadsheets

For more examples, see the readabs vignette.

News

readabs 0.3.0

  • Merged with getabs package
  • New core function (read_abs()) to download, import and tidy data in one step
  • New function (read_abs_local()) to import and tidy locally-stored spreadsheets
  • read_abs_data() is now soft-deprecated and will be removed in a future release

readabs 0.2.9

  • Matt Cowgill is the new maintainer and author of readabs
  • Fixed issue (#1) with blank column names that arose from new name repair behaviour in tibble 2.0.0

readabs 0.2.1

  • Add descriptive information to read_abs_sdmx()

readabs 0.2.0

  • Delete read_abs_codebook()
  • Create vignette and website using pkgdown
  • Update documentation and available data

readabs 0.1.0

  • Name change from abs to readabs

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("readabs")

0.3.0 by Matt Cowgill, 3 months ago


https://github.com/mattcowgill/readabs


Report a bug at https://github.com/mattcowgill/readabs/issues


Browse source code at https://github.com/cran/readabs


Authors: Matt Cowgill [aut, cre] , Zoe Meers [aut] , Jaron Lee [aut]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports readxl, tibble, dplyr, XML, purrr, tidyr, rsdmx, readr

Suggests knitr, rmarkdown, testthat, RCurl, ggplot2


See at CRAN