Skip to content

Add support for tables with two leading zeros#282

Open
conanying wants to merge 2 commits into
MattCowgill:masterfrom
conanying:updated_lfs_tables
Open

Add support for tables with two leading zeros#282
conanying wants to merge 2 commits into
MattCowgill:masterfrom
conanying:updated_lfs_tables

Conversation

@conanying

Copy link
Copy Markdown

From the April 2026 reference period, the ABS has changed the table names for the Labour Force Survey. For example, "Table 19" is now "Table 017". A concordance is provided here.

As part of this change, table names are now three characters long ("Table 001"). When searching the ABS TSD, the correct number of leading zeros is required. Currently, a maximum of one leading zero is added, which now fails when searching for single digit tables from the LFS.

r$> dt <- read_abs("6202.0", tables = c("1"))

Finding URLs for tables corresponding to ABS catalogue 6202.0
Error in `map()`:
i In index: 1.
Caused by error in `get_specific_xml_page()`:
! Cannot find valid entry for requested datain the ABS Time Series Directory
Run `rlang::last_trace()` to see where the error occurred.

However, the download still works if you add a leading zero manually.

r$> dt <- read_abs("6202.0", tables = c("01"))

Finding URLs for tables corresponding to ABS catalogue 6202.0
Attempting to download files from catalogue 6202.0, Labour Force, Australia
trying URL 'https://www.abs.gov.au/statistics/labour/employment-and-unemployment/labour-force-australia/latest-release/62020001.xlsx'
Content type 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' length 768186 bytes (750 KB)
downloaded 750 KB

Extracting data from downloaded spreadsheets
Tidying data from imported ABS spreadsheets  

To resolve this, I've simply added another case. It tries adding two leading zeros ("001") if one leading zero ("01") still does not result in a readable XML file. (I don't often work on R packages, so a closer review may be warranted.)

As of April 2026, tables for the LFS are three characters long, for example Table 001. This adds support for this case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant