Last active
March 1, 2021 08:03
-
-
Save markgrujic/0320816613e23d4bb610dd3fd5b2e2a9 to your computer and use it in GitHub Desktop.
Quick summary of mining exploration stats up to EOY 2020
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(hues) | |
library(priceR) | |
library(readxl) | |
# get the file | |
download.file( | |
url = "https://www.abs.gov.au/statistics/industry/mining/mineral-and-petroleum-exploration-australia/dec-2020/8412005.xls", | |
destfile = "8412005.xls" | |
) | |
# read the file, modify as required | |
expl_q1 <- | |
read_xls("8412005.xls", "Data1") %>% | |
pivot_longer(cols = -Date, | |
names_to = c("State", "Commodity"), | |
values_to = "Expenditure", | |
names_sep = "_") %>% | |
mutate(Commodity = str_trim(Commodity), | |
ExpenditureAdj = adjust_for_inflation(price = Expenditure, | |
from_date = Date, | |
country = "Australia", | |
to_date = 2019)) | |
# plot relevant data: | |
ggplot(expl_q1 %>% filter(State != "Australia", | |
Commodity != "Total (List of Minerals)"), | |
aes(Date, ExpenditureAdj)) + | |
geom_bar(aes(fill = State), stat = "identity") + | |
scale_fill_manual(values = as.character(iwanthue(7))) + | |
ggtitle("Minerals exploration expenditure by state, inflation adjusted to 2019") + | |
facet_wrap(~Commodity, scales = "free_y", ncol = 3) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment