Housing

Completions

The Government’s Housing for All plan targets 24,600 completions in 2022, 29,000 in 2023 and 33,450 in 2024.

setwd("/Users/charten/OneDrive - Glenveagh Properties/Research & Development/1. Analysis/")
GEO_Merge <- readxl::read_xlsx(path="C:\\Users\\charten\\OneDrive - Glenveagh Properties\\Research & Development\\1. Analysis\\HPM04_GEO.xlsx",sheet = 1)
shp <- sf::read_sf("Constituency_Boundaries_Ungeneralised___OSi_National_Electoral_Boundaries___2017.shp")

## NDQ07
NDQ07 <- cso_get_data("NDQ07")
NDQ07_long <- NDQ07 %>%
  pivot_longer(!1:2, names_to = "year_qtr")
NDQ07 <- NDQ07_long
rm(NDQ07_long)
NDQ07$Year_Q <- as.yearqtr(NDQ07$year_qtr)
NDQ07$Year <- year(NDQ07$Year_Q)
NDQ07_A <- NDQ07 %>%
  filter(Eircode.Output=="All")

NDQ07_B <- NDQ07 %>%
  filter(Eircode.Output!="All")

NDQ07_join <- full_join(NDQ07_B, GEO_Merge, by = "Eircode.Output")
NDQ07 <- NDQ07_join
rm(NDQ07_join)
rm(NDQ07_B)
NDQ07_A_tail <- tail(NDQ07_A,1)
NDQ07_A_tail_lag <-head(tail(NDQ07_A,2),1)
NDQ07_A_tail_yonylag <-head(tail(NDQ07_A,5),1)

NDQ07_A_24 <- tail(NDQ07_A,24)
ggplot(data=NDQ07_A_24, aes(x=Year_Q, y=value))+
  geom_col(alpha = 0.5, colour="#373634", fill = "#1b5545")+
  labs(title = "New Dwelling Completions, by Quarter - NDQ07" ,
       subtitle = "24 Month Series",
       y="Units Completed",
       x="Year-Qtr")+
  geom_text(aes(label=value),vjust= 1.5, size=2)+
  theme(legend.position = "bottom")

tbl_NDQ07_A_Year <-  NDQ07_A %>%
  group_by(Year)%>%
  summarise(Average_Value = mean(value),
            Total = sum(value))

ggplot(data=tbl_NDQ07_A_Year, aes(x=Year, y=Total))+
  geom_col(alpha = 0.5, colour="#373634", fill = "#02218A")+
  labs(title = "New Dwelling Completions, by Year - NDQ07" ,
       subtitle = "total sample",
       y="Units Completed",
       x="Year")+
  geom_text(aes(label=Total),vjust= 1.5, size=3)+
  theme(legend.position = "bottom")+
  scale_x_continuous(breaks= 5)

NDQ07_Map <- NDQ07 %>%
  filter(year_qtr == NDQ07_A_tail$year_qtr)
NDQ07_Map_Dub <- NDQ07_Map %>% 
  filter(grepl('Dublin|Laoghaire', Seat_Tag))

shpNDQ <- merge(shp,NDQ07_Map, by.x = "CON_SEAT_", by.y="Seat_Tag")
shpNDQDub <- merge(shp,NDQ07_Map_Dub, by.x = "CON_SEAT_", by.y="Seat_Tag")

Map_1 <-  shpNDQ %>%
  ggplot()+
  geom_sf(aes(fill = value))+
 scale_fill_stepsn(n.breaks = 10,
    colors=c("#ECEFFB","#3966FE","#02218A"),
    name = "completions")+
    ggtitle('Eircode Output Aggregated to Constituency: Latest Quarter')+
  theme_void()+
  theme(legend.title = element_text(size = 10),
        legend.text = element_text(size = 8))+
    theme(legend.position = "left")+
  theme(plot.title = element_text(hjust = 1))

Map_2 <- shpNDQDub %>%
  ggplot()+
  geom_sf(aes(fill = value))+
 scale_fill_stepsn(n.breaks = 10,
    colors=c("#ECEFFB","#3966FE","#02218A"),
    name = "completions")+
    theme_void()+
  theme(legend.position = "none")


Map_View <- Map_1 + Map_2 +
  plot_layout(widths = c(2,1))

Map_View

Table%>%
  kbl(caption = "New Dwelling Completions - Sorted by Total")%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = T)%>%
  scroll_box(width = "600px", height = "300px") 
New Dwelling Completions - Sorted by Total
Eircode.Output Year_Q Constituency value
D18: Dublin 18 2022 Q2 Dublin Rathdown 528
D12: Dublin 12 2022 Q2 Dublin South Central 377
D09: Dublin 9 2022 Q2 Dublin North-West 340
H91: Galway 2022 Q2 Galway West 255
T12: Cork Southside 2022 Q2 Cork North-Central 234
A92: Drogheda 2022 Q2 Louth 225
W91: Naas 2022 Q2 Kildare North 220
C15: Navan 2022 Q2 Meath West 219
D07: Dublin 7 2022 Q2 Dublin West 219
W23: Celbridge 2022 Q2 Kildare North 196
V94: Limerick 2022 Q2 Limerick City 190
D22: Dublin 22 2022 Q2 Dublin South Central 189
A63: Greystones 2022 Q2 Wicklow 166
K78: Lucan 2022 Q2 Dublin Mid-West 159
V95: Ennis 2022 Q2 Clare 144
R95: Kilkenny 2022 Q2 Carlow-Kilkenny 138
A91: Dundalk 2022 Q2 Louth 133
V92: Tralee 2022 Q2 Kerry 120
W12: Newbridge 2022 Q2 Kildare South 115
R32: Portlaoise 2022 Q2 Laois-Offaly 114
D16: Dublin 16 2022 Q2 Dublin South-West 111
D13: Dublin 13 2022 Q2 Dublin Bay North 94
V93: Killarney 2022 Q2 Kerry 92
P43: Carrigaline 2022 Q2 Cork South-Central 91
T23: Cork Northside 2022 Q2 Cork North-Central 88
T45: Glanmire 2022 Q2 Cork North-Central 87
K36: Malahide 2022 Q2 Dublin Fingal 84
A67: Wicklow 2022 Q2 Wicklow 81
D01: Dublin 1 2022 Q2 Dublin Central 79
K56: Rush 2022 Q2 Dublin Fingal 78
N91: Mullingar 2022 Q2 Longford-Westmeath 70
D24: Dublin 24 2022 Q2 Dublin South-West 68
Y35: Wexford 2022 Q2 Wexford 68
P51: Mallow 2022 Q2 Cork East 67
X91: Waterford 2022 Q2 Waterford 63
F92: Letterkenny 2022 Q2 Donegal 62
R35: Tullamore 2022 Q2 Laois-Offaly 61
K32: Balbriggan 2022 Q2 Dublin Fingal 57
K45: Lusk 2022 Q2 Dublin Fingal 54
F94: Donegal 2022 Q2 Donegal 51
F93: Lifford 2022 Q2 Donegal 49
A85: Dunshaughlin 2022 Q2 Meath East 48
D17: Dublin 17 2022 Q2 Dublin Fingal 48
H12: Cavan 2022 Q2 Cavan-Monaghan 48
R93: Carlow 2022 Q2 Carlow-Kilkenny 48
Y25: Gorey 2022 Q2 Wexford 47
Y21: Enniscorthy 2022 Q2 Wexford 44
F91: Sligo 2022 Q2 Sligo-Leitrim 41
D04: Dublin 4 2022 Q2 Dublin Bay South 39
K67: Swords 2022 Q2 Dublin Fingal 38
H54: Tuam 2022 Q2 Galway East 37
A82: Kells 2022 Q2 Meath East 35
P25: Midleton 2022 Q2 Cork East 35
V35: Kilmallock 2022 Q2 Limerick County 34
D06: Dublin 6 2022 Q2 Dublin Bay South 33
P31: Ballincollig 2022 Q2 Cork North-West 33
P12: Macroom 2022 Q2 Cork North-West 32
A98: Bray 2022 Q2 Wicklow 31
N37: Athlone 2022 Q2 Longford-Westmeath 31
Y14: Arklow 2022 Q2 Wicklow 31
D15: Dublin 15 2022 Q2 Dublin West 30
F28: Westport 2022 Q2 Mayo 30
N39: Longford 2022 Q2 Longford-Westmeath 30
A81: Carrickmacross 2022 Q2 Cavan-Monaghan 29
F12: Claremorris 2022 Q2 Mayo 29
E45: Nenagh 2022 Q2 Tipperary 28
F26: Ballina 2022 Q2 Mayo 28
R56: Curragh 2022 Q2 Kildare South 28
H65: Athenry 2022 Q2 Galway East 27
P85: Clonakilty 2022 Q2 Cork South-West 27
A83: Enfield 2022 Q2 Meath West 26
D02: Dublin 2 2022 Q2 Dublin Bay South 26
H18: Monaghan 2022 Q2 Cavan-Monaghan 26
P17: Kinsale 2022 Q2 Cork South-West 25
F23: Castlebar 2022 Q2 Mayo 24
H53: Ballinasloe 2022 Q2 Roscommon-Galway 23
R51: Kildare 2022 Q2 Kildare South 23
A96: Glenageary 2022 Q2 Dun Laoghaire 22
H62: Loughrea 2022 Q2 Galway East 22
A75: Castleblaney 2022 Q2 Cavan-Monaghan 21
E91: Clonmel 2022 Q2 Tipperary 21
P72: Bandon 2022 Q2 Cork South-West 21
W34: Monasterevin 2022 Q2 Kildare South 20
E32: Carrick-on-Suir 2022 Q2 Tipperary 19
E41: Thurles 2022 Q2 Tipperary 19
P47: Dunmanway 2022 Q2 Cork South-West 19
P81: Skibbereen 2022 Q2 Cork South-West 19
D05: Dublin 5 2022 Q2 Dublin Bay North 18
H23: Clones 2022 Q2 Cavan-Monaghan 18
R42: Birr 2022 Q2 Laois-Offaly 18
V31: Listowel 2022 Q2 Kerry 18
D03: Dublin 3 2022 Q2 Dublin Bay North 16
P14: Crookstown 2022 Q2 Cork North-West 15
T34: Carrignavar 2022 Q2 Cork East 14
A86: Dunboyne 2022 Q2 Meath East 13
A94: Blackrock 2022 Q2 Dun Laoghaire 13
E34: Tipperary 2022 Q2 Tipperary 13
F45: Castlerea 2022 Q2 Roscommon-Galway 13
P24: Cobh 2022 Q2 Cork East 13
Y34: New Ross 2022 Q2 Wexford 13
D08: Dublin 8 2022 Q2 Dublin South Central 12
T56: Watergrasshill 2022 Q2 Cork North-Central 12
P61: Fermoy 2022 Q2 Cork East 11
R21: Mhuine Bheag 2022 Q2 Carlow-Kilkenny 11
R45: Edenderry 2022 Q2 Laois-Offaly 11
V14: Shannon 2022 Q2 Clare 11
F42: Roscommon 2022 Q2 Roscommon-Galway 10
V15: Kilrush 2022 Q2 Clare 10
H14: Belturbet 2022 Q2 Cavan-Monaghan 9
K34: Skerries 2022 Q2 Dublin Fingal 9
N41: Carrick-on-Shannon 2022 Q2 Sligo-Leitrim 9
E25: Cashel 2022 Q2 Tipperary 8
P36: Youghal 2022 Q2 Cork East 8
V42: Newcastle West 2022 Q2 Limerick County 8
X42: Kilmacthomas 2022 Q2 Waterford 8
X35: Dungarvan 2022 Q2 Waterford 7
D14: Dublin 14 2022 Q2 Dublin Bay South 6
P67: Mitchelstown 2022 Q2 Cork East 6
P75: Bantry 2022 Q2 Cork South-West 6
R14: Athy 2022 Q2 Kildare South 6
E21: Cahir 2022 Q2 Tipperary 5
A42: Garristown 2022 Q2 Dublin Fingal 4
D11: Dublin 11 2022 Q2 Dublin West 4
F31: Ballinrobe 2022 Q2 Mayo 4
F52: Boyle 2022 Q2 Sligo-Leitrim 4
H16: Cootehill 2022 Q2 Cavan-Monaghan 4
E53: Roscrea 2022 Q2 Tipperary 3
F35: Ballyhaunis 2022 Q2 Mayo 3
F56: Ballymote 2022 Q2 Sligo-Leitrim 3
P56: Charleville 2022 Q2 Cork North-West 3
A41: Ballyboughal 2022 Q2 Dublin Fingal 2
A45: Oldtown 2022 Q2 Dublin Fingal 2
A84: Ashbourne 2022 Q2 Meath East 2
D6W: Dublin 6W 2022 Q2 Dublin South Central 2
H71: Clifden 2022 Q2 Galway West 2
V23: Caherciveen 2022 Q2 Kerry 2
D10: Dublin 10 2022 Q2 Dublin South Central 1
D20: Dublin 20 2022 Q2 Dublin South Central 0
P32: Rylane 2022 Q2 Cork North-West 0

House Price Index

HPM09 <- cso_get_data("HPM09")
HPM09_long <- HPM09 %>%
  pivot_longer(!1:2, names_to = "year_month")
rm(HPM09)
HPM09 <- HPM09_long
rm(HPM09_long)

HPM09$Month <- as.Date(paste(HPM09$year_month, "01", sep = "-"), "%YM%m-%d")
HPM09$Year <- year(HPM09$Month)
HPM04 <- cso_get_data("HPM04")
HPM04_long <- HPM04 %>%
  pivot_longer(!1:5, names_to = "year_month")
rm(HPM04)
HPM04 <- HPM04_long
rm(HPM04_long)
### Date transformation
HPM04$Year <-substr(HPM04$year_month,1,4)
HPM04$Month <- sub(".* ", "", HPM04$year_month)
HPM04$Month_NR <- as.integer(factor(HPM04$Month, levels=month.name))
HPM04$Date <- as.yearmon(paste(HPM04$Year, HPM04$Month_NR), "%Y %m")
HPM04_join <- full_join(HPM04, GEO_Merge, by = "Eircode.Output")
HPM04 <- HPM04_join
rm(HPM04_join)
HPM09$month <- months(as.Date(HPM09$Month))

HPM09_1 <- HPM09 %>%
  filter(Statistic == "Residential Property Price Index")%>%
  filter(Type.of.Residential.Property == "National - all residential properties")

HPM09_2 <- HPM09 %>%
  filter(Statistic == "Percentage Change over 12 months for Residential Property Price Index")%>%
  filter(Type.of.Residential.Property == "National - all residential properties")

RPPI_tail_2 <- tail(HPM09_2,1)
RPPI_tail_2_lag <-head(tail(HPM09_2,2),1)
RRPI_Line_1 <- ggplot(data=HPM09_1, aes(x=Month, y=value, group = Type.of.Residential.Property))+
  geom_line(linejoin="mitre",size = 1.25, linetype = 1,alpha = 0.5, colour="#1b5545")+
  labs(title = "Residential Property Price Index" ,
       y="2015 = 100",
       x="Month")+
  geom_text_repel(aes(label=value),data = HPM09_1, size = 3)+
  theme(legend.position = "bottom")

RRPI_Line_1

HPM09_1_T12 <- tail(HPM09_1,12)
RRPI_Line_2 <- ggplot(data=HPM09_1_T12, aes(x=Month, y=value, group = Type.of.Residential.Property))+
  geom_line(linejoin="mitre",size = 1.25, linetype = 1,alpha = 0.5, colour="#1b5545")+
  labs(title = "Residential Property Price Index" ,
       subtitle = "12 Month Series",
       y="2015 = 100",
       x="Month")+
  geom_text(aes(label=value),vjust= 1.5, hjust = 0, size=3)+
  theme(legend.position = "bottom")

RRPI_Line_2

HPM09_2_T24 <- tail(HPM09_2,24)
colour <- ifelse(HPM09_2_T24$value < 0,"#CC0000","#1b5545")
RPPI_Bar_2 <- ggplot(data=HPM09_2_T24, aes(x=Month, y=value, group = Type.of.Residential.Property))+
  geom_col(alpha = 0.5, colour="#373634", fill = colour)+
  labs(title = "Year on Year Percentage Change for Residential Property Price Index" ,
       subtitle = "24 Month Series",
       y="Percentage change",
       x="Month")+
  geom_text(aes(label=value),vjust= 1.5, size=3)+
  theme(legend.position = "bottom")

rm(HPM09)

HPM04_1A <- HPM04 %>%
  filter(Statistic == "Mean Sale Price")%>%
  filter(Dwelling.Status == "All Dwelling Statuses") %>%
  filter(Stamp.Duty.Event == "Executions") %>%
  filter(Type.of.Buyer == "All Buyer Types") %>%
  filter(Eircode.Output == "All")

HPM04_1B <- HPM04 %>%
  filter(Statistic == "Mean Sale Price")%>%
  filter(Dwelling.Status == "All Dwelling Statuses") %>%
  filter(Stamp.Duty.Event == "Executions") %>%
  filter(Type.of.Buyer == "All Buyer Types") %>%
  filter(Eircode.Output != "All")

HPM04_1B_Map <- na.omit(HPM04_1B)
HPM04_1B_Map<- HPM04_1B_Map %>%
  group_by(Seat_Tag, Date)%>% # change to/from County / Constituency
  summarise(Average_Value = mean(value))

HPM04_1B_Map$lagvalue_12mth <- Lag(HPM04_1B_Map$Average_Value,12)
HPM04_1B_Map$Diff <- HPM04_1B_Map$Average_Value - HPM04_1B_Map$lagvalue_12mth
HPM04_1B_Map$Diffpc <- HPM04_1B_Map$Diff / HPM04_1B_Map$lagvalue_12mth
HPM04_1B_Map$Diffpc<-percent(HPM04_1B_Map$Diffpc,2)


HPM04_1B_Map_May2022 <- HPM04_1B_Map%>%
  filter(Date == "May 2022")

shpHPM <- merge(shp,HPM04_1B_Map_May2022, by.x = "CON_SEAT_", by.y="Seat_Tag")
HPM04_1B_Map_May2022_Dub <- HPM04_1B_Map_May2022 %>% 
  filter(grepl('Dublin|Laoghaire', Seat_Tag))

shpHPMDub <- merge(shp,HPM04_1B_Map_May2022_Dub, by.x = "CON_SEAT_", by.y="Seat_Tag")

Map2_DiffpcAll <-  shpHPM %>%
  ggplot()+
  geom_sf(aes(fill = Diffpc))+
 scale_fill_stepsn(n.breaks = 10,
    colors=c("#F92306","#FFFFFF","#0C4F00"),
    limits = c(-1,1),
    name = "% change")+
    ggtitle('Year on Year Change by Constituency - HPM04')+
  theme_void()+
  theme(legend.title = element_text(size = 10),
        legend.text = element_text(size = 8))+
    theme(legend.position = "left")+
  theme(plot.title = element_text(hjust = 1))

Map2_DiffpcDub <- shpHPMDub %>%
  ggplot()+
  geom_sf(aes(fill = Diffpc))+
 scale_fill_stepsn(n.breaks = 10,
    colors=c("#F92306","#FFFFFF","#0C4F00"),
    limits = c(-1,1),
    name = "% change")+
    theme_void()+
  theme(legend.position = "none")


Map2_Diffpc <- Map2_DiffpcAll + Map2_DiffpcDub +
  plot_layout(widths = c(2,1))

Map2_Diffpc

Average percentage change year on year is 13.79%. This was 13.57% in the Dublin constituencies.

HPM04_1B_Map_May2022%>%
  kbl(caption = "Year on Year ")%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = T)%>%
  scroll_box(width = "600px", height = "300px") 
Year on Year
Seat_Tag Date Average_Value lagvalue_12mth Diff Diffpc
Carlow-Kilkenny (5) May 2022 216527.7 199519.3 17008.33 8.52%
Cavan-Monaghan (5) May 2022 177097.0 144608.4 32488.57 22.47%
Clare (4) May 2022 224667.0 172103.7 52563.33 30.54%
Cork East (4) May 2022 254092.0 222825.8 31266.17 14.03%
Cork North-Central (4) May 2022 362033.0 296311.0 65722.00 22.18%
Cork North-West (3) May 2022 295421.8 216368.6 79053.15 36.54%
Cork South-Central (4) May 2022 387499.0 355174.0 32325.00 9.10%
Cork South-West (3) May 2022 317929.7 218142.0 99787.67 45.74%
Donegal (5) May 2022 166165.3 137711.7 28453.67 20.66%
Dublin Bay North (5) May 2022 477757.7 462236.7 15521.00 3.36%
Dublin Bay South (4) May 2022 1061525.3 617102.3 444423.00 72.02%
Dublin Central (4) May 2022 380833.0 283600.0 97233.00 34.29%
Dublin Fingal (5) May 2022 400859.1 350144.0 50715.12 14.48%
Dublin Mid-West (4) May 2022 374310.0 328365.0 45945.00 13.99%
Dublin North-West (3) May 2022 465500.0 450125.0 15375.00 3.42%
Dublin Rathdown (3) May 2022 610032.0 584364.0 25668.00 4.39%
Dublin South-West (5) May 2022 558630.0 538289.7 20340.33 3.78%
Dublin South Central (4) May 2022 390266.2 406003.2 -15737.00 -3.88%
Dublin West (4) May 2022 399194.5 390229.0 8965.50 2.30%
Dun Laoghaire (4) May 2022 798034.5 789073.5 8961.00 1.14%
Galway East (3) May 2022 245063.7 232117.7 12946.00 5.58%
Galway West (5) May 2022 256908.0 330317.5 -73409.50 -22.22%
Kerry (5) May 2022 243051.5 193255.0 49796.50 25.77%
Kildare North (4) May 2022 387790.5 355096.5 32694.00 9.21%
Kildare South (4) May 2022 249614.0 258038.0 -8424.00 -3.26%
Laois-Offaly (5) May 2022 209237.0 187944.2 21292.75 11.33%
Limerick City (4) May 2022 273538.0 244928.0 28610.00 11.68%
Limerick County (3) May 2022 143393.0 158415.5 -15022.50 -9.48%
Longford-Westmeath (4) May 2022 225328.7 186934.0 38394.67 20.54%
Louth (5) May 2022 271900.0 250552.0 21348.00 8.52%
Mayo (4) May 2022 178087.7 163940.8 14146.83 8.63%
Meath East (3) May 2022 338315.4 346414.4 -8099.00 -2.34%
Meath West (3) May 2022 271314.0 288824.0 -17510.00 -6.06%
Roscommon-Galway (3) May 2022 191973.7 150357.3 41616.33 27.68%
Sligo-Leitrim (4) May 2022 166604.0 159675.0 6929.00 4.34%
Tipperary (5) May 2022 214051.4 152241.0 61810.38 40.60%
Waterford (4) May 2022 285926.0 212470.7 73455.33 34.57%
Wexford (5) May 2022 230609.2 208450.8 22158.50 10.63%
Wicklow (5) May 2022 434795.8 421322.0 13473.75 3.20%

Inflation

EIHC06 <- cso_get_data("EIHC06")
EIHC06 <- EIHC06 %>%
  pivot_longer(!1:3, names_to = "year_month")
EIHC06 <- EIHC06 %>%
  filter(Statistic=="Contribution to CPI percentage change in last 12 months")
EIHC06$Decile_Nr <- extract_numeric(EIHC06$Income.Deciles)

EIHC06A<- EIHC06 %>%
  filter(COICOP.Division=="All Items")%>%
  filter(Income.Deciles=="All deciles")

EIHC06B<- EIHC06 %>%
  filter(COICOP.Division!="All Items")%>%
  filter(Income.Deciles!="All deciles")

See below contribution to inflation by income decile. Next quarters will likely show the mortgage rate increase

HeatMap<-ggplot(data=EIHC06B, mapping = aes(x = Income.Deciles, y = COICOP.Division, fill = value))+
  geom_tile()+
  xlab(label = "Income Deciles")+
  theme(axis.text.x = element_text(angle = 90, hjust = 1))+
  theme(legend.position = "bottom")+
  scale_fill_gradient(name = "Contribution to Inflation",
                      low = "#F9F9FA",
                      high = "#010874")

HeatMap + facet_wrap(~year_month,ncol=1)

Retail Sales

## NDQ07
RSM05 <- cso_get_data("RSM05")
RSM05 <- RSM05 %>%
  pivot_longer(!1:2, names_to = "year_month")

# Date transformation

## Take adjusted index only

RSM05 <- RSM05%>%filter(Statistic=="Retail Sales Index Value Adjusted"|Statistic=="Retail Sales Index Volume Adjusted")

RSM05$Month <- as.Date(paste(RSM05$year_month, "01", sep = "-"), "%YM%m-%d")
RSM05$Year <- year(RSM05$Month)
RSM05$Lag <- Lag(RSM05$value,1)
RSM05$Diff <- RSM05$value-RSM05$Lag

RSM05_A <- RSM05%>%
  filter(NACE.Group=="All retail businesses")

RSM05_B <- RSM05%>%
  filter(NACE.Group=="Motor trades (45)"|NACE.Group=="Retail sale in non-specialised stores with food, beverages or tobacco predominating (4711)"|NACE.Group=="Department stores (4719)"|NACE.Group=="Retail sale of automotive fuel (4730)"|NACE.Group=="Retail sale of hardware, paints and glass (4752)"|NACE.Group=="Retail sale of furniture and lighting (4759)"|NACE.Group=="Bars (5630)")

RSM05_A1 <- RSM05_A%>%filter(Statistic=="Retail Sales Index Value Adjusted")
RSM05_A2 <- RSM05_A%>%filter(Statistic=="Retail Sales Index Volume Adjusted")

RSM05_B1 <- RSM05_B%>%filter(Statistic=="Retail Sales Index Value Adjusted")
RSM05_B2 <- RSM05_B%>%filter(Statistic=="Retail Sales Index Volume Adjusted")

ggplot(data=RSM05_A1,aes(x=Month,y=value))+
  geom_line(size = 1.15, linetype=1, alpha = 0.6, colour = "#4aa98a")+
  geom_hline(aes(yintercept=100), 
             colour= "#404040",
             linetype = 1)+
  labs(title = "RSI Value (Adjusted) - CSO: RSM05", subtitle = "2015 to Date")+
  xlab("Year-Month")+
  ylab("Retail Sales Index (Base Dec 2015=100)")+
  theme(panel.border = element_rect(linetype = 1, fill = NA))

Wholesale Construction

Wholesale Price Index for Building and Construction Materials has 40 Types of Materials. Black line (100) indicates 2015 as baseline.

WPM28 <- cso_get_data("WPM28")
WPM28 <- WPM28 %>%
  pivot_longer(!1:2, names_to = "year_month")

# Date transformation

WPM28$Month <- as.Date(paste(WPM28$year_month, "01", sep = "-"), "%YM%m-%d")
WPM28$Year <- year(WPM28$Month)
WPM28$Lag <- Lag(WPM28$value,1)
WPM28$Diff <- WPM28$value-WPM28$Lag

# Take year greater than or equal to 2019
WPM28 <- WPM28 %>%
  filter(Year >= "2021")

WPM28_A <- WPM28%>%
  filter(Statistic=="Wholesale Price Index (Excl VAT) for Building and Construction Materials")

Fig2<-ggplot(WPM28_A, aes(x=Month, y=value, group=Type.of.Material, colour=Type.of.Material))+
  geom_line(aes(group=Type.of.Material),size = 1.05, linetype=1, alpha = 0.65)+
  labs(title = "Wholesale Price Index (Excl VAT) for Building and Construction Materials")+
  xlab("Year-Month")+
  ylab("2015 = 100")+
  geom_hline(aes(yintercept=100), 
             colour= "#404040",
             linetype = 1)+
    scale_x_date(date_labels="%b-%Y",date_breaks  ="3 month")+
  theme(axis.text.x = element_text(angle=90))+
  theme(axis.text.x=element_text(size=10))+
  theme(legend.position="none")+
  theme(axis.text = element_text(size = rel(1)))+
  theme(plot.title=(element_text(vjust =2)))+
  theme(panel.border = element_rect(linetype = 1, fill = NA))

Fig2 + facet_wrap(~Type.of.Material, ncol = 2)