10/21/2018

Personal Public Service numbers (PPSN) allocated in Ireland to foreign nationals 2002-2016

We will download a dataset from the Central Statistics Office and examine the number of PPSN numbers allocated to foreign nationals in recent years.

library(pxR); library(ggplot2); library(dplyr) 
#Retrieve data from Central Statistics Office
FNA02 <- read.px("https://www.cso.ie/px/pxeirestat/Database/eirestat/Foreign%20National%20Activity/FNA02.px")
FNA02df <- as.data.frame(FNA02) #convert to data frame
str(FNA02df)
## 'data.frame':    2205 obs. of  4 variables:
##  $ Year                   : Factor w/ 15 levels "2002","2003",..: 1 2 3 4 5 6 7 8 9 10 ...
##  $ Year.of.Entry          : Factor w/ 21 levels "All PPSN allocations to foreign nationals aged 15 years and over",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ Broad.Nationality.Group: Factor w/ 7 levels "All nationalities",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ value                  : num  76919 70138 114750 168197 200450 ...

Construct ggplot

PPSN_numbers_issued <- FNA02df %>% 
  filter(Year.of.Entry == "All PPSN allocations to foreign nationals aged 15 years and over") %>% 
  select(-Year.of.Entry)
ggplot <- ggplot2::ggplot(data=PPSN_numbers_issued, aes(x=Year, y=value, 
                                     group=Broad.Nationality.Group,
                                     colour=Broad.Nationality.Group)) + 
  geom_line() + geom_point() +
  ggtitle("PPSN numbers issued to foreign nationals (2002-2016)") +
  ylab("Count") + theme_bw() + theme(legend.position = "top", legend.title = element_text(face = "bold")) 

plotly plot

The resulting plot shows that the numbers of foreign nationals coming to Ireland for work dropped during the recession but is starting to recover as the ecomony begins to grow once again.