This blog demonstrates how to access the Statbank API for Central Statistics Office (CSO) Ireland . This API utilises the JSON-stat format for encoding statistical information. This can be accessed using the jsonstat.py library for Python by Giovanni F., and also by the rjstat library created by A.J.Schumacher - The original Jupyter page - covering Python, is here - authored by Oliver Dawkins from the National Centre for Geocomputation, Maynooth University, Ireland - the github repo is virtualarchitectures/CSO_Ireland_JSONStat4Py. The Rmarkdown code for this blog is here.
Import Packages
from os import path
import jsonstat
import matplotlib.pyplot as plt
import pandas as pd
Create a cache directory to store copies of downloaded data for faster development and consistency
cache_dir = path.abspath(path.join("..", "Test_Data", "CSO_Test_DATA"))
jsonstat.cache_dir(cache_dir)
## '/Users/chrisbrunsdon/Dropbox/NCG603_sandbox/Test_Data/CSO_Test_DATA'
Identify CSO JSON table to download by table number
#Provide table identifier
table_id = "QLF08"
#Provide base url
base_uri = 'https://www.cso.ie/StatbankServices/StatbankServices.svc/jsonservice/responseinstance/'
uri = base_uri + table_id
#Specify name for cached file
filename = "cso_ie_" + table_id + ".json"
Load data into a collection
collection = jsonstat.from_url(uri, filename)
print(collection)
## JsonstatCollection contains the following JsonStatDataSet:
## +-----+-----------+
## | pos | dataset |
## +-----+-----------+
## | 0 | 'dataset' |
## +-----+-----------+
Select the first dataset in the collection and print its description
dataset = collection.dataset(0)
print(dataset)
## name: 'dataset'
## label: 'Persons aged 15 years and over by Region, Quarter and Statistic'
## source: 'Persons aged 15 years and over by Region, Quarter and Statistic'
## size: 1800
## +-----+-----------+-----------+------+--------+
## | pos | id | label | size | role |
## +-----+-----------+-----------+------+--------+
## | 0 | Region | Region | 12 | |
## | 1 | Quarter | Quarter | 30 | time |
## | 2 | Statistic | Statistic | 5 | metric |
## +-----+-----------+-----------+------+--------+
Print dimensions of the dataset for review
print(dataset.dimension('Region'))
## +-----+---------+------------------------+
## | pos | idx | label |
## +-----+---------+------------------------+
## | 0 | '-' | 'State' |
## | 1 | 'IE04' | 'Northern and Western' |
## | 2 | 'IE041' | 'Border' |
## | 3 | 'IE042' | 'West' |
## | 4 | 'IE05' | 'Southern' |
## | 5 | 'IE051' | 'Mid-West' |
## | 6 | 'IE052' | 'South-East' |
## | 7 | 'IE053' | 'South-West' |
## | 8 | 'IE06' | 'Eastern and Midland' |
## | 9 | 'IE061' | 'Dublin' |
## | 10 | 'IE062' | 'Mid-East' |
## | 11 | 'IE063' | 'Midland' |
## +-----+---------+------------------------+
print(dataset.dimension('Quarter'))
## +-----+----------+----------+
## | pos | idx | label |
## +-----+----------+----------+
## | 0 | '2012Q1' | '2012Q1' |
## | 1 | '2012Q2' | '2012Q2' |
## | 2 | '2012Q3' | '2012Q3' |
## | 3 | '2012Q4' | '2012Q4' |
## | 4 | '2013Q1' | '2013Q1' |
## | 5 | '2013Q2' | '2013Q2' |
## | 6 | '2013Q3' | '2013Q3' |
## | 7 | '2013Q4' | '2013Q4' |
## | 8 | '2014Q1' | '2014Q1' |
## | 9 | '2014Q2' | '2014Q2' |
## | 10 | '2014Q3' | '2014Q3' |
## | 11 | '2014Q4' | '2014Q4' |
## | 12 | '2015Q1' | '2015Q1' |
## | 13 | '2015Q2' | '2015Q2' |
## | 14 | '2015Q3' | '2015Q3' |
## | 15 | '2015Q4' | '2015Q4' |
## | 16 | '2016Q1' | '2016Q1' |
## | 17 | '2016Q2' | '2016Q2' |
## | 18 | '2016Q3' | '2016Q3' |
## | 19 | '2016Q4' | '2016Q4' |
## | 20 | '2017Q1' | '2017Q1' |
## | 21 | '2017Q2' | '2017Q2' |
## | 22 | '2017Q3' | '2017Q3' |
## | 23 | '2017Q4' | '2017Q4' |
## | 24 | '2018Q1' | '2018Q1' |
## | 25 | '2018Q2' | '2018Q2' |
## | 26 | '2018Q3' | '2018Q3' |
## | 27 | '2018Q4' | '2018Q4' |
## | 28 | '2019Q1' | '2019Q1' |
## | 29 | '2019Q2' | '2019Q2' |
## +-----+----------+----------+
print(dataset.dimension('Statistic'))
## +-----+------------+-------------------------------------------------------------+
## | pos | idx | label |
## +-----+------------+-------------------------------------------------------------+
## | 0 | 'QLF08C01' | 'Persons aged 15 years and over in Employment (Thousand)' |
## | 1 | 'QLF08C02' | 'Unemployed Persons aged 15 years and over (Thousand)' |
## | 2 | 'QLF08C03' | 'Persons aged 15 years and over in Labour Force (Thousand)' |
## | 3 | 'QLF08C04' | 'ILO Unemployment Rate (15 - 74 years) (%)' |
## | 4 | 'QLF08C05' | 'ILO Participation Rate (15 years and over) (%)' |
## +-----+------------+-------------------------------------------------------------+
Return a value - in this case we’ll select the value associated with the statistic for the number of unemployed people (thousands) in Dublin for the first quarter of 2019.
dataset.data(Region='Dublin', Quarter='2019Q1', Statistic='QLF08C02')
## JsonStatValue(idx=1491, value=32.1, status=None)
dataset.value(Region='Dublin', Quarter='2019Q1', Statistic='QLF08C02')
## 32.1
Convert dataset to a Pandas data frame
df_dataset = dataset.to_data_frame()
df_dataset.head(10)
## Region Quarter Statistic Value
## 0 State 2012Q1 Persons aged 15 years and over in Employment (... 1863.2
## 1 State 2012Q1 Unemployed Persons aged 15 years and over (Tho... 348.1
## 2 State 2012Q1 Persons aged 15 years and over in Labour Force... 2211.3
## 3 State 2012Q1 ILO Unemployment Rate (15 - 74 years) (%) 15.8
## 4 State 2012Q1 ILO Participation Rate (15 years and over) (%) 61.4
## 5 State 2012Q2 Persons aged 15 years and over in Employment (... 1878.0
## 6 State 2012Q2 Unemployed Persons aged 15 years and over (Tho... 352.7
## 7 State 2012Q2 Persons aged 15 years and over in Labour Force... 2230.7
## 8 State 2012Q2 ILO Unemployment Rate (15 - 74 years) (%) 15.9
## 9 State 2012Q2 ILO Participation Rate (15 years and over) (%) 61.9
Extract a subset of the data for unemployment figures - in this case we’ll select the subset of data for the number of unemployed people (thousands) in Dublin for all quarters available in the dataset. Quarter will be used as the index for the data frame. The region and statistic chose for the subset need to be specified by their index (idx).
df_dublin_unemployed = dataset.to_data_frame(blocked_dims={'Region':'IE061', 'Statistic':'QLF08C02'})
df_dublin_unemployed
## Region Quarter Statistic Value
## 0 Dublin 2012Q1 Unemployed Persons aged 15 years and over (Tho... 85.1
## 1 Dublin 2012Q2 Unemployed Persons aged 15 years and over (Tho... 79.7
## 2 Dublin 2012Q3 Unemployed Persons aged 15 years and over (Tho... 84.9
## 3 Dublin 2012Q4 Unemployed Persons aged 15 years and over (Tho... 72.2
## 4 Dublin 2013Q1 Unemployed Persons aged 15 years and over (Tho... 72.1
## 5 Dublin 2013Q2 Unemployed Persons aged 15 years and over (Tho... 79.5
## 6 Dublin 2013Q3 Unemployed Persons aged 15 years and over (Tho... 70.2
## 7 Dublin 2013Q4 Unemployed Persons aged 15 years and over (Tho... 66.6
## 8 Dublin 2014Q1 Unemployed Persons aged 15 years and over (Tho... 69.5
## 9 Dublin 2014Q2 Unemployed Persons aged 15 years and over (Tho... 68.0
## 10 Dublin 2014Q3 Unemployed Persons aged 15 years and over (Tho... 70.7
## 11 Dublin 2014Q4 Unemployed Persons aged 15 years and over (Tho... 59.2
## 12 Dublin 2015Q1 Unemployed Persons aged 15 years and over (Tho... 60.1
## 13 Dublin 2015Q2 Unemployed Persons aged 15 years and over (Tho... 55.5
## 14 Dublin 2015Q3 Unemployed Persons aged 15 years and over (Tho... 56.2
## 15 Dublin 2015Q4 Unemployed Persons aged 15 years and over (Tho... 52.6
## 16 Dublin 2016Q1 Unemployed Persons aged 15 years and over (Tho... 48.6
## 17 Dublin 2016Q2 Unemployed Persons aged 15 years and over (Tho... 58.1
## 18 Dublin 2016Q3 Unemployed Persons aged 15 years and over (Tho... 55.6
## 19 Dublin 2016Q4 Unemployed Persons aged 15 years and over (Tho... 45.1
## 20 Dublin 2017Q1 Unemployed Persons aged 15 years and over (Tho... 44.7
## 21 Dublin 2017Q2 Unemployed Persons aged 15 years and over (Tho... 46.1
## 22 Dublin 2017Q3 Unemployed Persons aged 15 years and over (Tho... 44.8
## 23 Dublin 2017Q4 Unemployed Persons aged 15 years and over (Tho... 43.4
## 24 Dublin 2018Q1 Unemployed Persons aged 15 years and over (Tho... 37.8
## 25 Dublin 2018Q2 Unemployed Persons aged 15 years and over (Tho... 38.5
## 26 Dublin 2018Q3 Unemployed Persons aged 15 years and over (Tho... 38.9
## 27 Dublin 2018Q4 Unemployed Persons aged 15 years and over (Tho... 36.4
## 28 Dublin 2019Q1 Unemployed Persons aged 15 years and over (Tho... 32.1
## 29 Dublin 2019Q2 Unemployed Persons aged 15 years and over (Tho... 32.7
Get summary statistics for the dataframe
df_dublin_unemployed.describe()
## Value
## count 30.000000
## mean 56.830000
## std 15.874924
## min 32.100000
## 25% 44.725000
## 50% 55.900000
## 75% 70.025000
## max 85.100000
Plot unemployment in Dublin
ax = plt.gca()
df_dublin_unemployed.plot(kind='line',color='cornflowerblue',label ='Unemployed',x='Quarter',y='Value',ax=ax)
plt.title("Unemployment in Dublin" + "\n" + "Persons aged 15 years and over (Thousands)")
plt.show()
Extract employment figures for Dublin
df_dublin_employed = dataset.to_data_frame(blocked_dims={'Region':'IE061', 'Statistic':'QLF08C01'})
df_dublin_employed
## Region Quarter Statistic Value
## 0 Dublin 2012Q1 Persons aged 15 years and over in Employment (... 543.5
## 1 Dublin 2012Q2 Persons aged 15 years and over in Employment (... 549.6
## 2 Dublin 2012Q3 Persons aged 15 years and over in Employment (... 552.0
## 3 Dublin 2012Q4 Persons aged 15 years and over in Employment (... 560.6
## 4 Dublin 2013Q1 Persons aged 15 years and over in Employment (... 550.3
## 5 Dublin 2013Q2 Persons aged 15 years and over in Employment (... 562.1
## 6 Dublin 2013Q3 Persons aged 15 years and over in Employment (... 576.3
## 7 Dublin 2013Q4 Persons aged 15 years and over in Employment (... 578.6
## 8 Dublin 2014Q1 Persons aged 15 years and over in Employment (... 581.1
## 9 Dublin 2014Q2 Persons aged 15 years and over in Employment (... 589.3
## 10 Dublin 2014Q3 Persons aged 15 years and over in Employment (... 593.9
## 11 Dublin 2014Q4 Persons aged 15 years and over in Employment (... 606.4
## 12 Dublin 2015Q1 Persons aged 15 years and over in Employment (... 600.9
## 13 Dublin 2015Q2 Persons aged 15 years and over in Employment (... 610.2
## 14 Dublin 2015Q3 Persons aged 15 years and over in Employment (... 622.7
## 15 Dublin 2015Q4 Persons aged 15 years and over in Employment (... 629.3
## 16 Dublin 2016Q1 Persons aged 15 years and over in Employment (... 633.8
## 17 Dublin 2016Q2 Persons aged 15 years and over in Employment (... 641.3
## 18 Dublin 2016Q3 Persons aged 15 years and over in Employment (... 648.2
## 19 Dublin 2016Q4 Persons aged 15 years and over in Employment (... 653.5
## 20 Dublin 2017Q1 Persons aged 15 years and over in Employment (... 648.8
## 21 Dublin 2017Q2 Persons aged 15 years and over in Employment (... 649.6
## 22 Dublin 2017Q3 Persons aged 15 years and over in Employment (... 663.3
## 23 Dublin 2017Q4 Persons aged 15 years and over in Employment (... 675.5
## 24 Dublin 2018Q1 Persons aged 15 years and over in Employment (... 683.9
## 25 Dublin 2018Q2 Persons aged 15 years and over in Employment (... 695.1
## 26 Dublin 2018Q3 Persons aged 15 years and over in Employment (... 696.2
## 27 Dublin 2018Q4 Persons aged 15 years and over in Employment (... 701.4
## 28 Dublin 2019Q1 Persons aged 15 years and over in Employment (... 704.9
## 29 Dublin 2019Q2 Persons aged 15 years and over in Employment (... 716.7
Plot employment figures for Dublin
ax = plt.gca()
df_dublin_employed.plot(kind='line',color='orange',label ='Employed',x='Quarter',y='Value',ax=ax)
plt.title("Employment in Dublin" + "\n" + "Persons aged 15 years and over (Thousands)")
plt.show()
Plot employment and unemployment figures for Dublin together on the same axis for comparison
ax = plt.gca()
df_dublin_employed.plot(kind='line',color='orange',label='Employed',x='Quarter',y='Value',ax=ax)
df_dublin_unemployed.plot(kind='line',color='cornflowerblue',label='Unemployed',x='Quarter',y='Value',ax=ax)
## <matplotlib.axes._subplots.AxesSubplot object at 0x1260b20d0>
plt.title("Employment versus Unemployment in Dublin" + "\n" + "Persons aged 15 years and over (Thousands)")
plt.show()
As an alternative plotting style, we could use the seaborn module:
import seaborn as sns
Use the default seaborn style (it looks a lot like ggplot in R)
sns.set()
Pull the required data out of df_dataset - we’ll take a copy, called test. As a first step, lets re-label the employment and unemployment counts to let cumbersome terms:
test = df_dataset.copy()
test.loc[test['Statistic']=='Persons aged 15 years and over in Employment (Thousand)','Statistic']='Employment'
test.loc[test['Statistic']=='Unemployed Persons aged 15 years and over (Thousand)','Statistic']='Unemployment'
Next use queries to pull out the two statistics of interest, just for the Dublin Region. Print it to see what you now have:
test = test.query("Statistic == 'Employment' | Statistic == 'Unemployment'").query("Region=='Dublin'")
test
## Region Quarter Statistic Value
## 1350 Dublin 2012Q1 Employment 543.5
## 1351 Dublin 2012Q1 Unemployment 85.1
## 1355 Dublin 2012Q2 Employment 549.6
## 1356 Dublin 2012Q2 Unemployment 79.7
## 1360 Dublin 2012Q3 Employment 552.0
## 1361 Dublin 2012Q3 Unemployment 84.9
## 1365 Dublin 2012Q4 Employment 560.6
## 1366 Dublin 2012Q4 Unemployment 72.2
## 1370 Dublin 2013Q1 Employment 550.3
## 1371 Dublin 2013Q1 Unemployment 72.1
## 1375 Dublin 2013Q2 Employment 562.1
## 1376 Dublin 2013Q2 Unemployment 79.5
## 1380 Dublin 2013Q3 Employment 576.3
## 1381 Dublin 2013Q3 Unemployment 70.2
## 1385 Dublin 2013Q4 Employment 578.6
## 1386 Dublin 2013Q4 Unemployment 66.6
## 1390 Dublin 2014Q1 Employment 581.1
## 1391 Dublin 2014Q1 Unemployment 69.5
## 1395 Dublin 2014Q2 Employment 589.3
## 1396 Dublin 2014Q2 Unemployment 68.0
## 1400 Dublin 2014Q3 Employment 593.9
## 1401 Dublin 2014Q3 Unemployment 70.7
## 1405 Dublin 2014Q4 Employment 606.4
## 1406 Dublin 2014Q4 Unemployment 59.2
## 1410 Dublin 2015Q1 Employment 600.9
## 1411 Dublin 2015Q1 Unemployment 60.1
## 1415 Dublin 2015Q2 Employment 610.2
## 1416 Dublin 2015Q2 Unemployment 55.5
## 1420 Dublin 2015Q3 Employment 622.7
## 1421 Dublin 2015Q3 Unemployment 56.2
## 1425 Dublin 2015Q4 Employment 629.3
## 1426 Dublin 2015Q4 Unemployment 52.6
## 1430 Dublin 2016Q1 Employment 633.8
## 1431 Dublin 2016Q1 Unemployment 48.6
## 1435 Dublin 2016Q2 Employment 641.3
## 1436 Dublin 2016Q2 Unemployment 58.1
## 1440 Dublin 2016Q3 Employment 648.2
## 1441 Dublin 2016Q3 Unemployment 55.6
## 1445 Dublin 2016Q4 Employment 653.5
## 1446 Dublin 2016Q4 Unemployment 45.1
## 1450 Dublin 2017Q1 Employment 648.8
## 1451 Dublin 2017Q1 Unemployment 44.7
## 1455 Dublin 2017Q2 Employment 649.6
## 1456 Dublin 2017Q2 Unemployment 46.1
## 1460 Dublin 2017Q3 Employment 663.3
## 1461 Dublin 2017Q3 Unemployment 44.8
## 1465 Dublin 2017Q4 Employment 675.5
## 1466 Dublin 2017Q4 Unemployment 43.4
## 1470 Dublin 2018Q1 Employment 683.9
## 1471 Dublin 2018Q1 Unemployment 37.8
## 1475 Dublin 2018Q2 Employment 695.1
## 1476 Dublin 2018Q2 Unemployment 38.5
## 1480 Dublin 2018Q3 Employment 696.2
## 1481 Dublin 2018Q3 Unemployment 38.9
## 1485 Dublin 2018Q4 Employment 701.4
## 1486 Dublin 2018Q4 Unemployment 36.4
## 1490 Dublin 2019Q1 Employment 704.9
## 1491 Dublin 2019Q1 Unemployment 32.1
## 1495 Dublin 2019Q2 Employment 716.7
## 1496 Dublin 2019Q2 Unemployment 32.7
Finally create a plot in seaborn:
sns.relplot(kind='line',hue='Statistic',x='Quarter',y='Value',data=test,ci=None)
## <seaborn.axisgrid.FacetGrid object at 0x1a29f4a410>
plt.show()
OO-er! Thats made a bit of a mess of the x-axis. The complication is that sometimes seaborn chooses crappy defaults for axis styles. It can be fixed by explicitly stating the x-axis style. Note that the set() modifications to g are carried out in place - that is, g itself is changed even though the statements don’t begin with g = ....
g = sns.relplot(kind='line',hue='Statistic',x='Quarter',y='Value',data=test,ci=None)
g.set_xticklabels(rotation=45)
## <seaborn.axisgrid.FacetGrid object at 0x1252c5810>
g.set(xlabel='Time')
## <seaborn.axisgrid.FacetGrid object at 0x1252c5810>
g.set(ylabel='Econ. Active People')
## <seaborn.axisgrid.FacetGrid object at 0x1252c5810>
g.set(xticks = ['2012Q1','2013Q1','2014Q1','2015Q1','2016Q1','2017Q1','2018Q1','2019Q1'])
## <seaborn.axisgrid.FacetGrid object at 0x1252c5810>
g.set(xticklabels=[2012,2013,2014,2015,2016,2017,2018,2019])
## <seaborn.axisgrid.FacetGrid object at 0x1252c5810>
plt.show()
Load libraries:
library(tidyverse)
library(rjstat)
library(ggplot2)
library(lubridate)
Construct the URI:
table_id <- "QLF08"
base_uri <- 'https://www.cso.ie/StatbankServices/StatbankServices.svc/jsonservice/responseinstance/'
uri <- paste0(base_uri,table_id)
Download the JSONstat stuff into a character array:
json_stat_QLF08 <- readLines(uri)
… and decode it. JSONstat objects can contain a list of data sets - here there is only one. Thus, the [[1]] is used at the end to choose the one data set in the list - ie the first one.
dataset <- fromJSONstat(json_stat_QLF08)[[1]]
head(dataset)
## Region Quarter Statistic
## 1 State 2012Q1 Persons aged 15 years and over in Employment (Thousand)
## 2 State 2012Q1 Unemployed Persons aged 15 years and over (Thousand)
## 3 State 2012Q1 Persons aged 15 years and over in Labour Force (Thousand)
## 4 State 2012Q1 ILO Unemployment Rate (15 - 74 years) (%)
## 5 State 2012Q1 ILO Participation Rate (15 years and over) (%)
## 6 State 2012Q2 Persons aged 15 years and over in Employment (Thousand)
## value
## 1 1863.2
## 2 348.1
## 3 2211.3
## 4 15.8
## 5 61.4
## 6 1878.0
The Statistic label here is quite cumbersome - as an alternative we can opt for id of the variables instead of the full label:
dataset_id <- fromJSONstat(json_stat_QLF08,naming = 'id')[[1]]
head(dataset_id)
## Region Quarter Statistic value
## 1 - 2012Q1 QLF08C01 1863.2
## 2 - 2012Q1 QLF08C02 348.1
## 3 - 2012Q1 QLF08C03 2211.3
## 4 - 2012Q1 QLF08C04 15.8
## 5 - 2012Q1 QLF08C05 61.4
## 6 - 2012Q2 QLF08C01 1878.0
It might be useful to make the format for Quarter into a proper date.
dataset <- dataset %>% mutate(Quarter=yq(Quarter))
We will now cut to the chase and produce the same graph (with unemployment and employment, directly in R via ggplot:
Firstly select out the Statistics that we want, and only for Dublin:
df_dublin <- dataset %>% filter(Region=="Dublin",Statistic %in% c('Persons aged 15 years and over in Employment (Thousand)','Unemployed Persons aged 15 years and over (Thousand)'))
Then, just plot it
ggplot(df_dublin,aes(x=Quarter,y=value,col=Statistic)) + geom_line() + xlab("Time") + ylab("Thousands") +
scale_color_manual(name="Statistic",
labels=c("Employed","Unemployed"),
values=c("orange","blue"))
It fairly easy via the plotly library to turn the ggplot object into a plotly object. This then gives an interactive plot witrh zooming and so on, for blogs and other web-based content.
library(plotly)
g <- ggplot(df_dublin,aes(x=Quarter,y=value,col=Statistic)) + geom_line() + xlab("Time") + ylab("Thousands") +
scale_color_manual(name="Statistic",
labels=c("Employed","Unemployed"),
values=c("orange","blue"))
ggplotly(g) %>% hide_legend()
dplyr/tidyverse based)This just does the same as above, but using ordinary R rather than using dplyr expressions involving pipelines (%>%) and so on. The stages up to the creation of dataset would be the same, so we’ll take it from there. For reproducibility, run the conversion from the JSONstat object again again:
dataset <- fromJSONstat(json_stat_QLF08)[[1]]
Then turn the quarters into proper date values:
dataset$Quarter <- yq(dataset$Quarter)
Then just select the Dublin data:
df_temp1 <- dataset[dataset$Region=="Dublin",]
At the moment the variables we are interested in are in key/value format. This means all of the variables are stored in just two columns, one is categorical and states which variable a record refers to (the key - here this is the Statistic column) and one stating which value it has (the value, here just called value). For more traditional R working it would be better to have the variables of interest as separate columns. To do this, firstly select out the Quarter and the value of the employment count:
emp_rows <- df_temp1$Statistic == 'Persons aged 15 years and over in Employment (Thousand)'
df_dublin_2 <- data.frame(Quarter=df_temp1[emp_rows,]$Quarter,Employment=df_temp1[emp_rows,]$value)
Now, add a new column with the unemployment data:
unemp_rows <- df_temp1$Statistic == 'Unemployed Persons aged 15 years and over (Thousand)'
df_dublin_2$Unemployment <- df_temp1[unemp_rows,]$value
Now we can draw the graph using plot etc:
plot(df_dublin_2$Quarter,
df_dublin_2$Employment,
xlab="Time",
ylab="Thousands",
type='l',col='blue',
ylim=c(0,750),
xlim=yq(c('2012Q1','2022Q2')))
lines(df_dublin_2$Quarter,df_dublin_2$Unemployment,col='orange')
legend(x=yq('2019Q2'),y=750,
c("Employment","Unemployment"),
col=c("blue","orange"),lty=c(1,1),bty='n')