A. High Quality Consumption & Asset Data

Vacancy - Market Level Reporting

history_vac <- vacant %>%
  dplyr::group_by(Period) %>%
  dplyr::summarise(
    VacantPremises = sum(VacantPremises),
    total = sum(Premises),
    percent_vacant = sum(VacantPremises) / sum(Premises)
  ) %>%
  dplyr::filter(Period > "2019-03-01")

vac_bar_plot <- history_vac %>%
  ggplot2::ggplot(ggplot2::aes(x = Period, y = VacantPremises, label = scales::comma(VacantPremises, accuracy = 1))) +
  ggplot2::geom_col(ggplot2::aes(x = Period, y = VacantPremises, fill = "MOSLR"), show.legend = FALSE) +
  MOSLR::scale_fill_MOSL() +
  ggplot2::labs(title = "Volume of Vacant Premises", y = "", x = "", caption = "Source: MOSL") +
  ggplot2::theme_bw() +
  ggplot2::scale_y_continuous(labels = scales::comma) +
  ggplot2::geom_text(nudge_y = 50000, check_overlap = TRUE)

vac_line_plot <- history_vac %>%
  ggplot2::ggplot(ggplot2::aes(x = Period, y = percent_vacant, label = scales::percent(percent_vacant, accuracy = 0.1))) + 
  ggplot2::geom_line(ggplot2::aes(x = Period, y = percent_vacant, colour = "MOSLR"), show.legend = FALSE) +
  ggplot2::geom_point(ggplot2::aes(x = Period, y = percent_vacant, fill = "MOSLR"), show.legend = FALSE) +
  MOSLR::scale_colour_MOSL() + 
  MOSLR::scale_fill_MOSL() +
  ggplot2::labs(title = "Vacancy Rate", y = "", x = "", caption = "Source: MOSL") +
  ggplot2::theme_bw() +
  ggplot2::scale_y_continuous(labels = scales::percent_format(accuracy = 1)) +
  ggplot2::geom_text(nudge_y = 0.01, check_overlap = TRUE)

combined_plot <- gridExtra::arrangeGrob(vac_bar_plot, vac_line_plot)

plot(combined_plot)

This chart shows the change in volume (bars) and % (line) of vacant premises, with a forecast for the next 3 months

\newpage

Vacancy - Trading Party Level Reporting

vac_MO_avg <- vacant %>%
      dplyr::filter(Period == "2017-04-01") %>%
      dplyr::summarise(Total = sum(VacantPremises) / sum(Premises))

graph_data <- MOSLR::MPOP_data_prep(
  df = vacant,
  df.tp = vacant_TP,
  output.table = "vacancy",
  by = "Retailer"
  )

MOSLR::bubble_chart(
  df = graph_data,
  vertical.sep = vac_MO_avg$Total,
  title = "Vacant premises change in the last 12 months by wholesaler-retailer pairing",
  subtitle = NULL,
  caption = "Source: MOSL", 
  x_lab = "Total % of vacant premises", 
  y_lab = "Change in % of vacant premises in the last 12 months"
  )

This chart shows relative volumes of Vacant Premises by Retailer and their movement over the past 12 months.

\clearpage \newpage

top10_vac_ret <- graph_data %>%
  dplyr::arrange(dplyr::desc(percent)) %>%
  dplyr::mutate(
    percent_temp = ifelse(
      percent - last_percent > 0, 
      paste0(round(percent * 100, 1), "\\% $\\uparrow$"), 
      paste0(round(percent * 100, 1), "\\% $\\downarrow$")
      ),
    percent_temp = kableExtra::cell_spec(
      percent_temp, 
      format = "latex",
      background = dplyr::case_when(
         percent > vac_MO_avg$Total + 0.02 ~ "#F08080",
         percent > vac_MO_avg$Total - 0.02 & percent < vac_MO_avg$Total + 0.02 ~ "#FFE699",
         percent < vac_MO_avg$Total - 0.02 ~ "#C6E0B4",
         TRUE ~ "#FFFFFF"), 
      escape = FALSE
      ),
    TotalPremises = scales::comma(TotalPremises, digits = 0),
    VacantPremises = scales::comma(VacantPremises, digits = 0)
    )

top10_vac_ret %>%
  dplyr::select(Retailer, TotalPremises, VacantPremises, percent_temp) %>%
  knitr::kable(
    booktabs = TRUE, format = "latex",
    col.names = c("Retailer", "Total number of premises", "Total number of vacant premises", "Percentage of vacant premises"),
    linesep = "", escape = FALSE,
    caption = "Retailer Vacancy ranking",
    align = c("l", rep("r", ncol(top10_vac_ret) - 1))
    ) %>%
  kableExtra::kable_styling(latex_options = c("hold_position", "scale_down")) %>%
  kableExtra::row_spec(1:nrow(top10_vac_ret), hline_after = TRUE)

\arrayrulecolor{white}

knitr::kable(
  table_legend_vac, booktabs = TRUE, format = table_format, col.names = c("", " ", " "),
  linesep = "", escape = FALSE
    ) %>%
  kableExtra::kable_styling(latex_options = c("hold_position", "scale_down")) %>%
  kableExtra::column_spec(1:3, width = "5cm")

\arrayrulecolor{black}

Only Retailers with more than 200 Premises are included here. The arrows indicate the change in percentage of Vacant premises compared to last month

\newpage

graph_data <- MOSLR::MPOP_data_prep(
  df = vacant,
  df.tp = vacant_TP,
  output.table = "vacancy",
  by = "Wholesaler"
  )

MOSLR::bubble_chart(
  df = graph_data,
  vertical.sep = vac_MO_avg$Total,
  title = "Wholesaler area vacant premises change in the last 12 months",
  subtitle = NULL,
  caption = "Source: MOSL",
  x_lab = "Total % of vacant premises",
  y_lab = "Change in % of vacant premises in the last 12 months"
  )

This chart shows relative volumes of Vacant Premises by Wholesaler area and their movement over the past 12 months.

\clearpage \newpage

top10_vac_whole <- graph_data %>%
  dplyr::mutate(
    percent_temp = ifelse(
      percent - last_percent > 0, 
      paste0(round(percent * 100, 1), "\\% $\\uparrow$"), 
      paste0(round(percent * 100, 1), "\\% $\\downarrow$")
      ),
    percent_temp = kableExtra::cell_spec(
      percent_temp,
      format = table_format,
      background = dplyr::case_when(
         percent > vac_MO_avg$Total + 0.02 ~ "#F08080",
         percent > vac_MO_avg$Total - 0.02 & percent < vac_MO_avg$Total + 0.02 ~ "#FFE699",
         percent < vac_MO_avg$Total - 0.02 ~ "#C6E0B4",
         TRUE ~ "#FFFFFF"
         ), 
      escape = FALSE),
    TotalPremises = scales::comma(TotalPremises, digits = 0),
    VacantPremises = scales::comma(VacantPremises, digits = 0)
    ) %>%
  dplyr::arrange(dplyr::desc(percent)) %>%
  dplyr::mutate(percent = paste0(round(percent * 100, 1), "\\%")) %>%
  dplyr::filter(!is.na(Total_Premises_april)) %>%
  dplyr::select(Wholesaler, TotalPremises, VacantPremises, percent_temp)

knitr::kable(
  top10_vac_whole,
  booktabs = TRUE, format = table_format,
  col.names = c("Wholesaler", "Total number of premises", "Total number of vacant premises", "Percentage of vacant premises"),
  linesep = "", escape = FALSE, caption = "Wholesaler area Vacancy ranking", align = c("l", rep("r", ncol(top10_vac_whole) - 1))
  ) %>%
  kableExtra::kable_styling(latex_options = c("hold_position", "scale_down")) %>%
  kableExtra::row_spec(1:nrow(top10_vac_whole), hline_after = TRUE)

\arrayrulecolor{white}

knitr::kable(
  table_legend_vac, booktabs = TRUE, format = table_format, col.names = c("", " ", " "), linesep = "", escape = FALSE
  ) %>%
  kableExtra::kable_styling(latex_options = c("hold_position", "scale_down")) %>%
  kableExtra::column_spec(1:3, width = "5cm")

\arrayrulecolor{black}

Only Wholesalers with more than 200 Premises are included here.
The arrows indicate the change in percentage of Vacant premises compared to last month

\newpage

graph_data <- MOSLR::MPOP_data_prep(
  df = vacant,
  df.tp = vacant_TP,
  output.table = "vacancy",
  by = "Pair"
  )

MOSLR::bubble_chart(
  df = graph_data,
  vertical.sep = vac_MO_avg$Total,
  title = "Vacant premises change in the last 12 months per Pairing",
  subtitle = NULL,
  caption = "Source: MOSL",
  x_lab = "Total % of vacant premises",
  y_lab = "Change in % of vacant premises in the last 12 months"
  )

This chart shows relative volumes of Vacant Premises by Wholesaler-Retailer Pairing and their movement over the past 12 months.

\clearpage \newpage

top10_vac_pair <- graph_data %>%
  dplyr::arrange(dplyr::desc(percent)) %>%
  dplyr::mutate(
    percent_temp = ifelse(
      percent - last_percent > 0, 
      paste0(round(percent*100, 1), "\\% $\\uparrow$"), 
      paste0(round(percent*100, 1), "\\% $\\downarrow$")
      ),
    percent_temp = kableExtra::cell_spec(
      percent_temp, format = table_format, 
      background = dplyr::case_when(
        percent > vac_MO_avg$Total + 0.02 ~ "#F08080",
        percent > vac_MO_avg$Total - 0.02 & percent < vac_MO_avg$Total + 0.02 ~ "#FFE699",
        percent < vac_MO_avg$Total - 0.02 ~ "#C6E0B4",
        TRUE ~ "#FFFFFF"
        ), 
      escape = FALSE),
    TotalPremises = scales::comma(TotalPremises, digits = 0),
    VacantPremises = scales::comma(VacantPremises, digits = 0)
    ) %>%
   dplyr::select(Pair, TotalPremises, VacantPremises, percent_temp)

knitr::kable(
  top10_vac_pair, booktabs = TRUE, format = table_format,
  col.names = c("Pairing", "Total number of premises", "Total number of vacant premises", "Percentage of vacant premises"),
  linesep = "", escape = FALSE, caption = "Pairing Vacancy ranking", 
  align = c("l", rep("r", ncol(top10_vac_pair) - 1))
    ) %>%
  kableExtra::kable_styling(latex_options = c("hold_position", "scale_down")) %>%
  kableExtra::row_spec(1:nrow(top10_vac_pair), hline_after = TRUE) %>%
  kableExtra::column_spec(1, width = "6.5cm")

\arrayrulecolor{white}

knitr::kable(
  table_legend_vac, booktabs = TRUE, format = table_format, col.names = c("", " ", " "), linesep = "", escape = FALSE) %>%
  kableExtra::kable_styling(latex_options = c("hold_position", "scale_down")) %>%
  kableExtra::column_spec(1:3, width = "5cm")

\arrayrulecolor{black}

Only Pairings with more than 6000 Premises are included here.
The arrows indicate the change in percentage of Vacant premises compared to last month

\newpage

vacant_current <- vacant %>%
  dplyr::filter(Period == max(vacant$Period)) %>%
  dplyr::filter(!is.na(VacantPremises)) %>%
  dplyr::arrange(RetailerID, WholesalerID)

vacancy_pivot <- vacant_current %>%
  dplyr::select(RetailerID, WholesalerID, VacantPremises) %>%
  tidyr::pivot_wider(names_from = WholesalerID, values_from = VacantPremises) %>%
  janitor::adorn_totals(where = c("row", "col")) %>%
  dplyr::mutate_if(is.numeric, ~scales::comma(., accuracy = 1)) %>%
  dplyr::mutate_all(~replace(., is.na(.), ""))  

knitr::kable(
  vacancy_pivot, 
  format = "latex", booktabs = TRUE, linesep = "",
  caption = "Total number of vacant premises",
  align = c("l", rep("c", ncol(vacancy_pivot) - 1)),
  col.names = c("", colnames(vacancy_pivot)[2:ncol(vacancy_pivot)])
  ) %>%
  kableExtra::kable_styling(
    bootstrap_options = "bordered",
    latex_options = c("hold_position", "scale_down", "striped"), 
    stripe_color = "blizzardblue"
  ) %>%
  kableExtra::column_spec(ncol(vacancy_pivot) - 1, border_right = TRUE) %>%
  kableExtra::row_spec(0, angle = 90) %>%
  kableExtra::row_spec(nrow(vacancy_pivot) - 1, hline_after = TRUE) %>%
  kableExtra::row_spec(nrow(vacancy_pivot), bold = TRUE) %>%
  kableExtra::column_spec(ncol(vacancy_pivot), bold = TRUE)
retailer_vacancy_total <- vacant_current %>%
  dplyr::group_by(RetailerID) %>%
  dplyr::summarise(Total = sum(VacantPremises) / sum(Premises))

wholesaler_vacancy_total <- vacant_current %>%
  dplyr::group_by(WholesalerID) %>%
  dplyr::summarise(Total = sum(VacantPremises) / sum(Premises)) %>%
  tidyr::pivot_wider(names_from = WholesalerID, values_from = Total)

vacancy_pivot <- vacant_current %>%
  dplyr::mutate(percent = VacantPremises / Premises) %>%
  dplyr::select(RetailerID, WholesalerID, percent) %>%
  tidyr::pivot_wider(names_from = WholesalerID, values_from = percent) %>%
  dplyr::bind_rows(wholesaler_vacancy_total) %>%
  dplyr::left_join(retailer_vacancy_total, by = "RetailerID") %>%
  tidyr::replace_na(list(RetailerID = "Total")) %>%
  janitor::adorn_pct_formatting()

knitr::kable(
  vacancy_pivot,
  format = table_format, booktabs = TRUE, linesep = "",
  caption = "Percentage of premises that are vacant",
  align = c("l", rep("c", ncol(vacancy_pivot) - 1)),
  col.names = c("", colnames(vacancy_pivot)[2:ncol(vacancy_pivot)])
  ) %>%
  kableExtra::kable_styling(
    latex_options = c("hold_position", "scale_down", "striped"), 
    stripe_color = "blizzardblue"
    ) %>%
  kableExtra::column_spec(ncol(vacancy_pivot) - 1, border_right = TRUE) %>%
  kableExtra::row_spec(0, angle = 90)  %>%
  kableExtra::row_spec(nrow(vacancy_pivot) - 1, hline_after = TRUE) %>%
  kableExtra::row_spec(nrow(vacancy_pivot), bold = TRUE) %>%
  kableExtra::column_spec(ncol(vacancy_pivot), bold = TRUE)

\clearpage



austl001/MOSLR documentation built on Aug. 17, 2022, 12:07 a.m.