Ireland’s Median Rainfall in January 1850-2014

Author

James Whelan

Published

May 1, 2026


Data Explanation

The dataset, rainfall.RData, contains historical monthly rainfall data from weather stations across Ireland. The key variables include:

  • Station: The name of the weather station (e.g., Belfast, Dublin Airport, Cork Airport and University College Galway.).
  • Year and Month: Indicate the date of the measurements.
  • Rainfall: The amount of rainfall measured in millimeters.

For this blog, I focused on the following four stations: - Belfast: A station located in the North of Ireland, known for its consistently high rainfall levels. - Dublin Airport: A coastal station with relatively moderate rainfall. - University College Galway: Located in the west of Ireland, this station experiences high rainfall due to its proximity to the Atlantic Ocean. - Cork Airport: A southern station with lower but variable rainfall patterns. —


Methods

To visualise the data, I followed these steps: 1. Data Loading and Exploration: Load the dataset and inspect its structure. 2. Filtering and Aggregation: Extract data for the four selected stations and aggregate monthly rainfall totals. 3. Time Series Conversion: Convert the data into time series objects for each station. 4. Combining and Visualising: Combine the time series into a single graph and create an interactive dygraph with sooming and filtering features.

The interactive dygraph allows users to explore monthly rainfall patterns over time, compare stations, and identify anomalies.


Code Used to Create the Dygraph


library(dygraphs)
Warning: package 'dygraphs' was built under R version 4.4.2
library(dplyr)
Warning: package 'dplyr' was built under R version 4.4.2

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(tidyverse)
Warning: package 'tidyverse' was built under R version 4.4.2
Warning: package 'ggplot2' was built under R version 4.4.2
Warning: package 'tidyr' was built under R version 4.4.2
Warning: package 'readr' was built under R version 4.4.2
Warning: package 'lubridate' was built under R version 4.4.2
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ forcats   1.0.0     ✔ readr     2.1.5
✔ ggplot2   3.5.1     ✔ stringr   1.5.1
✔ lubridate 1.9.4     ✔ tibble    3.2.1
✔ purrr     1.0.2     ✔ tidyr     1.3.1
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(xts)
Warning: package 'xts' was built under R version 4.4.2
Loading required package: zoo

Attaching package: 'zoo'

The following objects are masked from 'package:base':

    as.Date, as.Date.numeric


######################### Warning from 'xts' package ##########################
#                                                                             #
# The dplyr lag() function breaks how base R's lag() function is supposed to  #
# work, which breaks lag(my_xts). Calls to lag(my_xts) that you type or       #
# source() into this session won't work correctly.                            #
#                                                                             #
# Use stats::lag() to make sure you're not using dplyr::lag(), or you can add #
# conflictRules('dplyr', exclude = 'lag') to your .Rprofile to stop           #
# dplyr from breaking base R's lag() function.                                #
#                                                                             #
# Code in packages is not affected. It's protected by R's namespace mechanism #
# Set `options(xts.warn_dplyr_breaks_lag = FALSE)` to suppress this warning.  #
#                                                                             #
###############################################################################

Attaching package: 'xts'

The following objects are masked from 'package:dplyr':

    first, last
load("C:/Users/Jgnwh/Desktop/HTML Blog Working DIrectory/rainfall.RData")
ls()
[1] "rain"     "stations"
str(rain)
tibble [49,500 × 4] (S3: tbl_df/tbl/data.frame)
 $ Year    : num [1:49500] 1850 1851 1852 1853 1854 ...
 $ Month   : Factor w/ 12 levels "Jan","Feb","Mar",..: 1 1 1 1 1 1 1 1 1 1 ...
 $ Rainfall: num [1:49500] 169 236 250 209 188 ...
 $ Station : Named chr [1:49500] "Ardara" "Ardara" "Ardara" "Ardara" ...
  ..- attr(*, "names")= chr [1:49500] "Ardara" "Ardara" "Ardara" "Ardara" ...
head(rain)
# A tibble: 6 × 4
   Year Month Rainfall Station
  <dbl> <fct>    <dbl> <chr>  
1  1850 Jan      169   Ardara 
2  1851 Jan      236.  Ardara 
3  1852 Jan      250.  Ardara 
4  1853 Jan      209.  Ardara 
5  1854 Jan      188.  Ardara 
6  1855 Jan       32.3 Ardara 
stations <- c("Dublin Airport", "Belfast", "University College Galway", "Cork Airport")
dub_ts <- rain %>%
  filter(Station == "Dublin Airport") %>%
  summarise(Rainfall = sum(Rainfall), .by = c(Year, Month)) %>%
  pull(Rainfall) %>%
  ts(start = c(1850, 1), freq = 12)
bel_ts <- rain %>%
  filter(Station == "Belfast") %>%
  summarise(Rainfall = sum(Rainfall), .by = c(Year, Month)) %>%
  pull(Rainfall) %>%
  ts(start = c(1850, 1), freq = 12)
ucg_ts <- rain %>%
  filter(Station == "University College Galway") %>%
  summarise(Rainfall = sum(Rainfall), .by = c(Year, Month)) %>%
  pull(Rainfall) %>%
  ts(start = c(1850, 1), freq = 12)
cork_ts <- rain %>%
  filter(Station == "Cork Airport") %>%
  summarise(Rainfall = sum(Rainfall), .by = c(Year, Month)) %>%
  pull(Rainfall) %>%
  ts(start = c(1850, 1), freq = 12)
all_stations_ts <- cbind(bel_ts, dub_ts, ucg_ts, cork_ts)
colnames(all_stations_ts) <- c("Belfast", "Dublin Airport", "University College Galway", "Cork Airport")
dygraph(all_stations_ts, main = "Monthly Rainfall at Selected Stations") %>%
  dyRangeSelector() %>%
  dyAxis("y", label = "Rainfall (mm)") %>%
  dyLegend(show = "always") %>%
  dyOptions(drawGrid = TRUE)
dub_ts %>% dygraph(width=700,height=130,group="dub_belf",main="Dublin") 
bel_ts %>% dygraph(width=700,height=170,group="dub_belf",main="Belfast") %>% dyRangeSelector()
cork_ts %>% dygraph(width=700,height=130,group="dub_belf",main="Cork") %>% dyRangeSelector() 
ucg_ts %>% dygraph(width=700,height=130,group="dub_belf",main="University College Galway") %>% dyRangeSelector()
belfast_graph <- dygraph(bel_ts, main = "Monthly Rainfall - Belfast")
belfast_graph <- dyRangeSelector(belfast_graph)
belfast_graph <- dyAxis(belfast_graph, "y", label = "Rainfall (mm)")
belfast_graph <- dyLegend(belfast_graph, show = "always")
belfast_graph <- dyOptions(belfast_graph, drawGrid = TRUE)

Key Observations

From the interactive dygraph, Ican observe several interesting patterns:

  1. Regional Variations:

    Belfast and University College Galway consistently record higher rainfall compared to Dublin Airport and Cork Airport.

    This aligns with their geographical locations, as coastal and western regions of Ireland typically receive more precipitation.

  2. Seasonal Trends:

    Across all stations, rainfall peaks in the winter months, while the summer months show lower rainfall.

    These seasonal trends are expected, given Ireland’s climate.

  3. Anomalies:

    Sharp spikes in rainfall are occasionally observed, likely corresponding to extreme weather events such as storms or prolonged rainy periods.

    These anomalies are very much noticeable in Belfast and Galway.

Insights

  • The variability in rainfall across regions suggests the need for localised water management strategies.

  • Seasonal trends may help plan agricultural activities, especially in rain-dependent sectors.

  • Further analysis could focus on extreme rainfall events and their impact.

Conclusion

This analysis provides an interactive exploration of rainfall data across four key weather stations in Ireland. By visualising the data with a dygraph, we can identify regional and seasonal trends, as well as anomalies that merit further investigation. Such insights are crucial for understanding Ireland’s weather patterns and their implications for infrastructure, agriculture, and daily life.