Skip to content

Instantly share code, notes, and snippets.

View jan_ur_delta.R
library(readabs)
library(tidyverse)
ur <- read_abs_series("A84423050A") |>
select(date, ur = value)
dec_jan_moves <- ur |>
mutate(diff = ur - lag(ur, n = 1L, order_by = date)) |>
filter(month(date) == 1L) |>
mutate(is_latest = if_else(date == max(date), "Jan '23", "Other Januaries since 1979"))
@MattCowgill
MattCowgill / scrape_rba_monpol.R
Last active December 8, 2022 23:27
A function to scrape the full text of Reserve Bank of Australia monetary policy decisions
View scrape_rba_monpol.R
library(rvest)
library(tidyverse)
#' Scrape RBA monetary policy decision media releases in a tidy tibble
#' @param min_year If `NULL` (the default), all releases will be scraped. If a
#' year is specified (eg. `2015`), only releases from that year onwards will be
#' scraped.
#' @author Matt Cowgill
#' @examples
#' all_decisions <- scrape_monpol_decisions()
View unemp_reason_mackeyfied.R
library(tidyverse)
library(readabs)
library(data.table)
uq2a_dt <- download_abs_data_cube(catalogue_string = "labour-force-australia-detailed",
cube = "UQ2a") |>
readxl::read_excel(sheet = "Data 1",
skip = 3) |>
janitor::clean_names() |>
as.data.table()
View unemp_reason.R
library(tidyverse)
library(ggdirectlabel) # remotes::install_github("MattCowgill/ggdirectlabel")
library(readabs)
read_lfs_datacube <- function(cube,
catalogue_string = "labour-force-australia-detailed",
update_date = Sys.Date()) {
file <- download_abs_data_cube(
catalogue_string = catalogue_string,
cube = cube
View ur_revisions.R
library(readabs) # Need dev version: remotes::install_github("mattcowgill/readabs")
library(tidyverse)
get_ur <- function(release_date = "latest",
series_id = "A84423050A") {
raw <- read_abs_series(series_id = series_id,
release_date = release_date) |>
select(date, series_id, value)
if (release_date == "latest") {
View ur_revisions.R
library(readabs) # Need dev version: remotes::install_github("mattcowgill/readabs")
library(tidyverse)
get_ur <- function(release_date = "latest",
series_id = "A84423050A") {
raw <- read_abs_series(series_id = series_id,
release_date = release_date) |>
select(date, series_id, value)
if (release_date == "latest") {
View oz_arg.R
library(readxl)
library(tidyverse)
library(ggdirectlabel)
library(patchwork)
madd_url <- "https://www.rug.nl/ggdc/historicaldevelopment/maddison/data/mpd2020.xlsx"
madd_file <- tempfile(fileext = ".xlsx")
download.file(madd_url, madd_file, mode = "wb")
madd_data <- read_excel(madd_file, sheet = "Full data")
View oz_arg.R
library(readxl)
library(tidyverse)
library(geomtextpath)
library(seektheme)
library(patchwork)
madd_url <- "https://www.rug.nl/ggdc/historicaldevelopment/maddison/data/mpd2020.xlsx"
madd_file <- tempfile(fileext = ".xlsx")
download.file(madd_url, madd_file, mode = "wb")
View read estimated dwelling stock by SA2
library(readabs)
path <- file.path(tempdir(), "abs_dwellings")
dir.create(path)
dwellings_sa2_zip <- download_abs_data_cube("estimated-dwelling-stock",
"zip",
path = path)
zip::unzip(dwellings_sa2_zip,
View code.R
This file has been truncated, but you can view the full file.
c("JUN-16", "SEP-16", "DEC-16", "MAR-17", "JUN-17", "SEP-17", "DEC-17", "MAR-18", "JUN-18", "SEP-18", "DEC-18", "MAR-19", "JUN-19", "SEP-19", "DEC-19", "MAR-20", "JUN-20", "SEP-20", "DEC-20", "MAR-21", "JUN-21", "SEP-21", "DEC-21", "MAR-22", "JUN-22", "JUN-16", "SEP-16", "DEC-16", "MAR-17", "JUN-17", "SEP-17", "DEC-17", "MAR-18", "JUN-18", "SEP-18", "DEC-18", "MAR-19", "JUN-19", "SEP-19", "DEC-19", "MAR-20", "JUN-20", "SEP-20", "DEC-20", "MAR-21", "JUN-21", "SEP-21", "DEC-21", "MAR-22", "JUN-22",
"JUN-16", "SEP-16", "DEC-16", "MAR-17", "JUN-17", "SEP-17", "DEC-17", "MAR-18", "JUN-18", "SEP-18", "DEC-18", "MAR-19", "JUN-19", "SEP-19", "DEC-19", "MAR-20", "JUN-20", "SEP-20", "DEC-20", "MAR-21", "JUN-21", "SEP-21", "DEC-21", "MAR-22", "JUN-22", "JUN-16", "SEP-16", "DEC-16", "MAR-17", "JUN-17", "SEP-17", "DEC-17", "MAR-18", "JUN-18", "SEP-18", "DEC-18", "MAR-19", "JUN-19", "SEP-19", "DEC-19", "MAR-20", "JUN-20", "SEP-20", "DEC-20", "MAR-21", "JUN-21", "SEP-21", "DEC-21", "MAR-22", "JUN-22", "JUN-16",
"SEP-16",