# 0) Define required packages individually (avoid 'tidyverse' meta-package)
pkgs <- c(
"readxl", # Excel import
"dplyr", # data wrangling
"tidyr", # pivot_longer
"stringr", # str_split_fixed, str_trim
"plotly", # interactive plots
"lubridate", # date handling
"zoo", # as.yearqtr, rollmean
"viridis", # colour scales
"forcats", # fct_reorder
"ggplot2" # static plots
)
new_pkgs <- setdiff(pkgs, rownames(installed.packages()))
if(length(new_pkgs)) install.packages(new_pkgs, repos = "https://cloud.r-project.org")
lapply(pkgs, library, character.only = TRUE)##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
## Loading required package: ggplot2
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
##
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
##
## date, intersect, setdiff, union
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
## Loading required package: viridisLite
## [[1]]
## [1] "readxl" "stats" "graphics" "grDevices" "utils" "datasets"
## [7] "methods" "base"
##
## [[2]]
## [1] "dplyr" "readxl" "stats" "graphics" "grDevices" "utils"
## [7] "datasets" "methods" "base"
##
## [[3]]
## [1] "tidyr" "dplyr" "readxl" "stats" "graphics" "grDevices"
## [7] "utils" "datasets" "methods" "base"
##
## [[4]]
## [1] "stringr" "tidyr" "dplyr" "readxl" "stats" "graphics"
## [7] "grDevices" "utils" "datasets" "methods" "base"
##
## [[5]]
## [1] "plotly" "ggplot2" "stringr" "tidyr" "dplyr" "readxl"
## [7] "stats" "graphics" "grDevices" "utils" "datasets" "methods"
## [13] "base"
##
## [[6]]
## [1] "lubridate" "plotly" "ggplot2" "stringr" "tidyr" "dplyr"
## [7] "readxl" "stats" "graphics" "grDevices" "utils" "datasets"
## [13] "methods" "base"
##
## [[7]]
## [1] "zoo" "lubridate" "plotly" "ggplot2" "stringr" "tidyr"
## [7] "dplyr" "readxl" "stats" "graphics" "grDevices" "utils"
## [13] "datasets" "methods" "base"
##
## [[8]]
## [1] "viridis" "viridisLite" "zoo" "lubridate" "plotly"
## [6] "ggplot2" "stringr" "tidyr" "dplyr" "readxl"
## [11] "stats" "graphics" "grDevices" "utils" "datasets"
## [16] "methods" "base"
##
## [[9]]
## [1] "forcats" "viridis" "viridisLite" "zoo" "lubridate"
## [6] "plotly" "ggplot2" "stringr" "tidyr" "dplyr"
## [11] "readxl" "stats" "graphics" "grDevices" "utils"
## [16] "datasets" "methods" "base"
##
## [[10]]
## [1] "forcats" "viridis" "viridisLite" "zoo" "lubridate"
## [6] "plotly" "ggplot2" "stringr" "tidyr" "dplyr"
## [11] "readxl" "stats" "graphics" "grDevices" "utils"
## [16] "datasets" "methods" "base"
# 1) Extract human-readable labels from Excel's first row
h1 <- read_excel("640107.xlsx", sheet = "Data6", n_max = 1, col_names = FALSE)## New names:
## • `` -> `...1`
## • `` -> `...2`
## • `` -> `...3`
## • `` -> `...4`
## • `` -> `...5`
## • `` -> `...6`
## • `` -> `...7`
## • `` -> `...8`
## • `` -> `...9`
## • `` -> `...10`
## • `` -> `...11`
## • `` -> `...12`
## • `` -> `...13`
## • `` -> `...14`
## • `` -> `...15`
## • `` -> `...16`
## • `` -> `...17`
## • `` -> `...18`
## • `` -> `...19`
## • `` -> `...20`
## • `` -> `...21`
## • `` -> `...22`
## • `` -> `...23`
## • `` -> `...24`
## • `` -> `...25`
## • `` -> `...26`
## • `` -> `...27`
## • `` -> `...28`
## • `` -> `...29`
## • `` -> `...30`
## • `` -> `...31`
## • `` -> `...32`
## • `` -> `...33`
## • `` -> `...34`
## • `` -> `...35`
## • `` -> `...36`
## • `` -> `...37`
## • `` -> `...38`
## • `` -> `...39`
## • `` -> `...40`
## • `` -> `...41`
## • `` -> `...42`
## • `` -> `...43`
## • `` -> `...44`
## • `` -> `...45`
## • `` -> `...46`
## • `` -> `...47`
## • `` -> `...48`
## • `` -> `...49`
## • `` -> `...50`
## • `` -> `...51`
## • `` -> `...52`
## • `` -> `...53`
## • `` -> `...54`
## • `` -> `...55`
## • `` -> `...56`
## • `` -> `...57`
## • `` -> `...58`
## • `` -> `...59`
## • `` -> `...60`
## • `` -> `...61`
## • `` -> `...62`
## • `` -> `...63`
## • `` -> `...64`
## • `` -> `...65`
## • `` -> `...66`
## • `` -> `...67`
## • `` -> `...68`
## • `` -> `...69`
## • `` -> `...70`
## • `` -> `...71`
## • `` -> `...72`
## • `` -> `...73`
## • `` -> `...74`
## • `` -> `...75`
## • `` -> `...76`
## • `` -> `...77`
## • `` -> `...78`
## • `` -> `...79`
## • `` -> `...80`
## • `` -> `...81`
## • `` -> `...82`
## • `` -> `...83`
## • `` -> `...84`
## • `` -> `...85`
## • `` -> `...86`
## • `` -> `...87`
## • `` -> `...88`
## • `` -> `...89`
## • `` -> `...90`
## • `` -> `...91`
## • `` -> `...92`
## • `` -> `...93`
## • `` -> `...94`
## • `` -> `...95`
## • `` -> `...96`
## • `` -> `...97`
## • `` -> `...98`
## • `` -> `...99`
## • `` -> `...100`
## • `` -> `...101`
## • `` -> `...102`
## • `` -> `...103`
## • `` -> `...104`
## • `` -> `...105`
## • `` -> `...106`
## • `` -> `...107`
## • `` -> `...108`
## • `` -> `...109`
## • `` -> `...110`
## • `` -> `...111`
## • `` -> `...112`
## • `` -> `...113`
## • `` -> `...114`
## • `` -> `...115`
## • `` -> `...116`
## • `` -> `...117`
## • `` -> `...118`
raw_labels <- h1 %>% select(-1) %>% unlist(use.names = FALSE)
parts <- str_split_fixed(raw_labels, ";", n = 3)
labels <- str_trim(parts[, 2])
# 2) Read CPI data (skip metadata rows)
df <- read_excel("640107.xlsx", sheet = "Data6", skip = 9)
names(df)[1] <- "Quarter"
names(df)[-1] <- labels## Warning in names(df)[-1] <- labels: number of items to replace is not a
## multiple of replacement length
# 3) Tidy & compute YoY%
cpi_long <- df %>%
pivot_longer(-Quarter, names_to = "Category", values_to = "Index") %>%
filter(!is.na(Index)) %>%
mutate(
Date = as.Date(as.yearqtr(Quarter)),
YoY = (Index / lag(Index, 4) - 1) * 100
)
latest_qtr <- max(cpi_long$Date, na.rm = TRUE)
cats <- sort(unique(cpi_long$Category))
# 4) Helpers to select key series by pattern type
pick_cat <- function(pattern) {
grep(pattern, cats, value = TRUE, ignore.case = TRUE)[1]
}
cat_allgroups <- pick_cat("all groups")
cat_rent <- pick_cat("^Rents?$")
cat_util <- pick_cat("utilities")Australia’s CPI surged post‑pandemic, then moderated—yet some
components remain elevated.
This presentation identifies which categories are
holding inflation above the RBA’s target.
pivot_longer().Australian Bureau of Statistics. (2025, April 30). Consumer Price
Index, Australia: March quarter 2025 (Cat. No. 6401.0).
Reserve Bank of Australia. (2025, May). Statement on Monetary Policy
– May 2025.
R Core Team. (2024). R: A language & environment for
statistical computing.
Wickham, H. et al. (2019). Welcome to the tidyverse.
JOSS, 4(43).