Storytelling with data visualization - most affordable state to live in Australia

Hashita Nallamani

library(ggplot2)
library(dplyr)
## 
## 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
library(readr)
library(tidyr)
library(plotly)
## 
## 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
Job_vacancies <- read_csv("/cloud/project/Job vacancies, states and territories, original.csv")
## Rows: 21 Columns: 9
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): time
## dbl (8): NSW, VIC, QLD, SA, WA, TAS, NT, ACT
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Job_vacancies_long <- Job_vacancies %>%
  pivot_longer(cols = -time, names_to = "State", values_to = "Value")

Job_vacancies_long$time <- factor(Job_vacancies_long$time, levels = Job_vacancies$time)
p1 <- ggplot(Job_vacancies_long, aes(x = time, y = Value, color = State, group = State)) +
  geom_line() +
  geom_point() +
  labs(title = "Job Vacancies Over Time by State",
       x = "Time",
       y = "Job Vacancies",
       color = "State") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

states <- c("NSW","VIC","QLD","SA","WA","TAS","NT","ACT")
unemployment.rate <- c(4397.1,3682.9,2885.3,945.9,1587.3,282.9,140.8,263.1)

unemployment <- data.frame(states,unemployment.rate)

p2<- ggplot(unemployment, aes(x = states, y = unemployment.rate)) +
  geom_bar(stat = "identity", fill = "lavender") +
  labs(title = "Unemployment Rates by State",
       x = "State",
       y = "Unemployment Rate") +
  theme_minimal() +
  theme(axis.text.x = element_text(hjust = 1))

despite job vacancies being highest in NSW , VIC & QLD unemployment rates are also highest in QLD , NSW & VIC

state <- c("NSW","VIC","QLD","SA","WA","TAS")
  weekly.income <- c(1891.40, 1858.10, 1844.70, 1735.40, 2107.70, 1670.00)
  weekly.grocery <- c(159, 153, 165, 171, 153, 166) 
weekly.rent <- c(600,445,480,450,460,500)
  data <-data.frame(state,weekly.grocery,weekly.grocery,weekly.rent)
  
p3 <- ggplot(data, aes(x = state)) +
  geom_bar(aes(y = weekly.income, fill = "Weekly Income"), stat = "identity", position = "dodge", width = 0.5) +
  labs(x = "State", y = "Amount", title = "Weekly Income by State") +
  scale_fill_manual(values = c("Weekly Income" = "skyblue")) +
  theme_minimal()

data_long <- pivot_longer(data, cols = c("weekly.grocery", "weekly.rent"), 
                          names_to = "variable", values_to = "value")

p4 <- ggplot(data_long, aes(x = state, y = value, fill = variable)) +
  geom_bar(stat = "identity", width = 0.7) +
  labs(x = "State", y = "Amount", title = "Weekly Grocery Expenses and Rent by State") +
  scale_fill_manual(values = c("weekly.grocery" = "yellow", "weekly.rent" = "lightgreen"),
                    labels = c("Weekly Grocery", "Weekly Rent")) +
  theme_minimal()

NSW , VIC & WA have the highest incomes in the country

rent price & groceries on a weekly average are the highest in NSW and lowest in WA

CPI <- read.csv("/cloud/project/All groups CPI, Index numbers(a).csv")


CPI_long <- CPI %>% pivot_longer(cols = -Period, names_to = "City", values_to = "Value")

CPI_long$Period <- factor(CPI_long$Period , levels = CPI$Period)

p5 <- ggplot(CPI_long, aes(x = Period, y = Value, color = City, group = City)) +
  geom_line() +
  geom_point() +
  labs(title = "CPI Over Time by City",
       x = "Period",
       y = "CPI",
       color = "City") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 90, hjust = 1))

The increasing consumer price index over time only makes the cost of living situation worse.

summary

# With increasing CPI , rent & grocery prices over time
# and high unemployment rates & job vacancies 
# NSW , QLD & VIC are the least affordable to live in
# WA , SA - most affordable to live in

references

#1. Australian Bureau of Statistics. (2024, February).
#Job Vacancies, Australia. ABS. #https://www.abs.gov.au/statistics/labour/jobs/job-vacancies-australia/latest-release.

#2.Australian Bureau of Statistics. (2024, April).
#Labour Force, Australia. ABS. #https://www.abs.gov.au/statistics/labour
#/employment-and-unemployment/labour-force-
#australia/latest-release.

#3.Dean H.(2023). what is the average grocery bill.
#Canstar blue. 
#https://www.canstarblue.com.au/groceries/average-grocery-bill/

#4.Australian Bureau of Statistics. (Mar-quarter-2024). #Consumer Price Index, Australia. ABS.
# https://www.abs.gov.au/statistics/economy
#/price-indexes-and-inflation/consumer-price
#-index-australia/latest-release.

#5. Australian Bureau of Statistics. (2023, November). #Average Weekly Earnings, Australia. ABS. 
# https://www.abs.gov.au/statistics/labour/
# earnings-and-working-conditions/average-
# weekly-earnings-australia/nov-2023.