Introduction

For my geospatial project, I decided to look at the housing market in Ireland. Since the pandemic began, there have been economic fluctuations worldwide. It has grown increasingly more difficult to secure housing, and Ireland is no exception. For this project, I aim to look at data for rental properties in Dublin and residences for sale throughout Ireland.

Hypothesis

I anticipate to see a rise in the cost of housing. My reasoning is based off of two things: (1)Implications of the pandemic. Ireland was in level five restrictions for a large span of 2021, stalling many agencies of work; including government offices and real estate. (2)There has been a lot of controversy around wind farms. The Irish government is pushing for renewable resources, but guidelines for these farms are highly debated.

Data

The data for this project was collected found on the following websites:

https://www.kaggle.com/datasets/d17129765/predicting-dublin-rental-daftie

https://www.kaggle.com/datasets/erinkhoo/property-price-register-ireland

In the code they will be referenced as daft and property, respectively.

First, the required libraries must be loaded.

Required Libraries

library(dplyr)
library(ggplot2)
library(tidyverse)
library(leaflet)
library(plotly)
library(tigris)
library(sf)
library(mapview)
library(RColorBrewer)
library(lubridate)
library(knitr)
library(gridExtra)
library(kableExtra)

The daft Data Frame

The first data frame is about different rental properties across the city of Dublin. All of these residences were on the market in September of 2020. Information included in the data frame are rent, address, number of bedrooms, number of bathrooms, property type and coordinates, among a few other categories.

Map of Rental Properties

The leaflet package can take the latitude and longitude columns to create a map of the properties. Currently, the column types are incompatible with this package, and must be changed to numeric. Once updating the data frame, leaflet can be run.

as.numeric(daft$longitude) -> daft$longitude
as.numeric(daft$latitude) -> daft$latitude

map1 <- leaflet() %>% 
  addTiles() %>% 
  setView(lng = -6.278242, lat =53.347616 , zoom = 10) %>% 
  addCircleMarkers(
    data = daft,
    radius = 3,
    color = "magenta",
    stroke = FALSE,
    popup = paste0(daft$price)
  )
map1

The properties are fairly equally spread out across Dublin, with a stronger concentration towards the center of the city. This makes sense because the middle has many accessible methods of public transportation, lots of stores and restaurants, more businesses, schools, and is very walkable.

Rental Property Types

The majority of these dots are representing apartments. The graph below presents the amount of available properties for rent, by type.

ggplot(daft, aes(x = ptype, fill = ptype)) +
  geom_bar() +
  geom_text(stat = 'count', aes(label = ..count..), vjust = 1.5) +
  scale_fill_brewer(palette = "GnBu") +
  labs(title = "Rental Property Types",
       x = "Property Type",
       y = "Count") +
  theme(legend.position = "none")

Apartment and Flat are essentially the same thing, and are often used interchangeably. The only difference is that apartments are “more upmarket”. Since https://www.daft.ie/ did distinguish between the two, I thought it was best to keep them separate instead of combining them.

Rental Prices

In this data frame, some of rents are given ‘per week’ while others are ‘per month’. Before any statistics can be calculated, all properties need to be referring to the same time frame. This process is fairly long and complex, requiring the rentals to first be split into two separate datasets. Then the price column is edited individually in each, and proper adjustments are made to transform the weekly costs to monthly. Finally they are combined back into one data frame. Below is that code, followed by a table of some summary statistics.

daft2 <- daft
filter(daft2, grepl('Per week', price)) -> daft2
str_replace_all(daft2$price, "€", "") -> daft2$price
str_replace_all(daft2$price, "\\,", "") -> daft2$price
str_replace_all(daft2$price, ' Per week', "") -> daft2$price
as.numeric(daft2$price) -> daft2$price
daft2$price * 4 -> daft2$price

daft3 <- daft
filter(daft3, grepl('Per month', price)) -> daft3
str_replace_all(daft3$price, " Per month", "") -> daft3$price
str_replace_all(daft3$price, "€", "") -> daft3$price
str_replace_all(daft3$price, "\\,", "") -> daft3$price
as.numeric(daft3$price) -> daft3$price

daft_edit <- bind_rows(daft3, daft2)
Summary Statistics
Min. 480.000
1st Qu. 1650.000
Median 1950.000
Mean 2164.711
3rd Qu. 2400.000
Max. 33600.000

These graphs are showing how price is affected by the number of bedrooms and/or bathrooms.

daft_edit %>% 
  group_by(bedroom) %>% 
  summarize(rented = mean(price)) -> avg_bed
daft_edit %>% 
  group_by(bathroom) %>% 
  summarize(rented2 = mean(price)) -> avg_bath
bed <- ggplot(avg_bed, aes(x = bedroom, y = rented)) +
  geom_col(aes(fill = factor(bedroom))) +
  labs(x = "Number of Bedrooms",
       y = "Rental Price",
       title = "Average Rent by Bedroom Count") +
  scale_fill_hue(h = c(180, 225)) +
  theme(legend.position = "none") +
  scale_x_continuous(breaks = seq(0, 9, 1))
bath <- ggplot(avg_bath, aes(x = bathroom, y = rented2)) +
  geom_col(aes(fill = factor(bathroom))) +
  labs(x = "Number of Bathrooms",
       y = "Rental Price",
       title = "Average Rent by Bathroom Count") +
  scale_fill_hue(h = c(225, 270)) +
  theme(legend.position = "none")
grid.arrange(bed, bath, nrow = 1)

As one would expect, cost increases alongside bedroom and bathroom count. Both appear to spike around 5. Less than 1% of the properties have 5 or more bedrooms. About 2.5% of residences have 5 or more bathrooms.

Now moving onto Ireland overall.

The property Data Frame

This data frame contains houses sold across Ireland from 2010 to 2021. It includes the sale date, county, address, sale price (and if it was market price), and a description among a few other details. Before any comparisons can be made, a few functions from the dplyr package have been applied. First, the residences are grouped by county, then the mean sale price is calculated.

cnty_price <- property %>% 
  group_by(county) %>% 
  summarize(counties_price = mean(sale_price, na.rm = TRUE))
ggplot(cnty_price, aes(x = county, y = counties_price,
                       fill = county)) +
  geom_col() +
  labs(title = "Average Sale Price per County",
       x = "County",
       y = "Sale Price") +
  scale_fill_hue(h = c(180, 270)) +
  scale_y_continuous(labels = scales::comma) +
  theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
  theme(legend.position = "none")

The bar graph above averages sale prices for more than a decade. To get a better understanding of changes in the housing market, I have created a line graph of the mean sale for each county throughout the years. The lubridate package pulls the year out of the sale_date column. Then I put that into a new data frame along with the county and sale price.

Changes in Sale Prices

year(property$sale_date) -> sale_year
prop2 <- data.frame(sale_year, property$county, property$sale_price)
rename(prop2, year = sale_year, county = property.county,
       price = property.sale_price) -> prop2
prop2 %>% 
  group_by(year, county) %>% 
  summarize(mnprice = mean(price)) -> prop3

ggplot(prop3, aes(x = year, y = mnprice, color = county)) +
  geom_line() +
  labs(title = "Changes in Average Sale Price Over the Years by County",
       x = "Year",
       y = "Mean Sale Price") +
  scale_y_continuous(labels = scales::comma)

From this graph, it looks like housing is more expensive now than it has been in the past decade. It appears the lowest prices were around 2013. Tables for 2021 and 2013 have been put side-by-side for easy comparison. The 2021 table is highlighted in blue and the 2013 in purple.

2021 & 2013 Comparison

2021
county maximum minimum difference
Carlow 2389213 11500 2377713
Cavan 421000 12000 409000
Clare 850000 8000 842000
Cork 5502040 17500 5484540
Donegal 1450000 9000 1441000
Dublin 170142820 6900 170135920
Galway 3215859 7000 3208859
Kerry 2693062 10000 2683062
Kildare 7048458 20000 7028458
Kilkenny 3346000 9000 3337000
Laois 3591667 36000 3555667
Leitrim 370000 10000 360000
Limerick 11250000 10000 11240000
Longford 2490000 18000 2472000
Louth 2874586 14000 2860586
Mayo 718000 5500 712500
Meath 7704846 7000 7697846
Monaghan 1054918 15000 1039918
Offaly 525000 6348 518652
Roscommon 560000 7250 552750
Sligo 1020000 15000 1005000
Tipperary 1400000 10000 1390000
Waterford 885000 24000 861000
Westmeath 859031 25000 834031
Wexford 1384659 7500 1377159
Wicklow 4600000 37820 4562180
2013
county maximum minimum difference
Carlow 2097577 7500.00 2090077
Cavan 459000 9000.00 450000
Clare 1462500 9190.00 1453310
Cork 18441108 5996.97 18435111
Donegal 665000 6667.00 658333
Dublin 61828630 5280.00 61823350
Galway 2100000 10000.00 2090000
Kerry 1600000 7500.00 1592500
Kildare 4875000 6500.00 4868500
Kilkenny 730000 11000.00 719000
Laois 2350000 7000.00 2343000
Leitrim 250000 6000.00 244000
Limerick 2000000 7000.00 1993000
Longford 360000 7500.00 352500
Louth 1900000 8333.00 1891667
Mayo 1000000 5500.00 994500
Meath 3300000 8831.00 3291169
Monaghan 525000 10000.00 515000
Offaly 450000 6200.00 443800
Roscommon 640000 10000.00 630000
Sligo 900000 10000.00 890000
Tipperary 850000 7000.00 843000
Waterford 2181000 10000.00 2171000
Westmeath 700000 6500.00 693500
Wexford 710000 6000.00 704000
Wicklow 5850000 8811.00 5841189

Conclusion

In conclusion, price of housing in Ireland has increased in recent years. Although I do not know for certain, my educated guess is that the pandemic and wind farm controversy. The lowest and highest parts of the graph correlates to the timing of the COVID outbreak and concerns about wind farms by the Irish people. Further analysis into more related topics, like economics and demographics, might be able to provide a more precise answer. Data from further back than 2010 could also give some useful insight. One thing I can confidently state is property costs are at a high.