knitr::opts_chunk$set(echo = FALSE, fig.cap = TRUE, warning = FALSE, message = FALSE)
library(officedown)
library(unhcrthemes)
library(ggplot2)
library(rvg)
library(tidyverse)
library(scales)
library(lubridate) 
library(fontawesome)

##  make sure to get last version of the data
if ( packageVersion("ForcedDisplacementStat") != "0.0.1"){pak::pkg_install("edouard-legoupil/ForcedDisplacementStat")}
library(ForcedDisplacementStat)

##  make sure to get last version of the chart library
if ( packageVersion("unhcrdatapackage") != "0.1.8"){pak::pkg_install("edouard-legoupil/unhcrdatapackage")}
library(unhcrdatapackage)

# fa_metadata()

# turn off the automatic use of showtext functionality, so that the dml function can works properly
showtext::showtext_auto(FALSE) 

Data literacy...

... describes the ability to read, analyze, and argue with data.

Numbers have an important story to tell. They rely on YOU to give them a voice!

-- Stephen Few


plot_ctr_keyfig(year = params$year,
                 country_asylum_iso3c = params$country)  -> p
dml(ggobj = p, fonts = list(serif = 'Lato'))

Population Data


plot_ctr_treemap(year = params$year,
                 country_asylum_iso3c = params$country,
                 pop_type = c("REF", "ASY", "DIP","OOC", "STA", "OIP")
         )  -> p
dml(ggobj = p, fonts = list(serif = 'Lato'))

## How the different Categories of Population of concern to UNHCR are evolving over time?
# According to official information provided by government authorities, as of December `r params$year`, the population of interest to UNHCR in `r params$country` reached `r format(round(total_poc, 0),  big.mark=",")` people. Compared to `r as.numeric(params$year)-1`, the total population `r ifelse(perc_change_poc>0, paste0("has increased ", format(round(perc_change_poc, 1),  big.mark=","), "% during the year"), ifelse(perc_change_poc<0, paste0("has decreased ", format(round(perc_change_poc, 1),  big.mark=","), "% during the year"), "has not changed"))`. Moreover, there was a `r format(round(perc_change_asy_ref, 0),  big.mark=",")`% `r ifelse(perc_change_asy_ref>0, "growth", ifelse(perc_change_asy_ref<0, "drop","change"))` of refugees and asylum seekers in the country.
plot_ctr_population_type_per_year(year = 2022,
                                  lag = 5,
                         country_asylum_iso3c = params$country,
                          pop_type = c("REF",
                                       "ASY",
                                       "OIP",
                                       "OOC",
                                       "STA",
                                       "IDP" )) -> p
dml(ggobj = p, fonts = list(serif = 'Lato'))

## What are the main countries of Origin of Forced Displacement across Borders?

#  
# text <- The three main countries of origin for Refugees were `r top_ref[1,1]` (`r top_ref[1,3]` of the total refugee population), `r top_ref[2,1]` (`r top_ref[2,3]` of the total refugee population) and `r top_ref[3,1]` (`r top_ref[3,3]` of the total refugee population). Regarding the asylum-seeker population, the three main countries of origin for  asylum-seekers were `r top_asy[1,1]` (`r top_asy[1,3]` of the total asylum-seekers  population), `r top_asy[2,1]` (`r top_asy[2,3]` of the total asylum-seekers  population) and `r top_asy[3,1]` (`r top_asy[3,3]` of the total asylum-seekers  population).


### Refugees

plot_ctr_population_type_abs(year = params$year,
                    country_asylum_iso3c = params$country,
                    top_n_countries = 9,
                    pop_type = "REF"
                    ) +
  labs(title = paste0("Refugees: Main Countries of origin | ", params$year)) -> p
dml(ggobj = p, fonts = list(serif = 'Lato'))

# 
plot_ctr_origin_history(year = params$year,
                         country_asylum_iso3c  = params$country,
                        lag = 5,
                          pop_type = c("REF", 
                                       "ASY", 
                                       "OIP", 
                                       "IDP" ),
                        otherprop = .02) -> p
dml(ggobj = p, fonts = list(serif = 'Lato'))

### Asylum Seekers

plot_ctr_population_type_abs(year = params$year,
                    country_asylum_iso3c = params$country,
                    top_n_countries = 9,
                    pop_type = "ASY"
                    ) +
  labs(title = paste0("Asylum-seekers: Main Countries of origin | ", params$year)) -> p
dml(ggobj = p, fonts = list(serif = 'Lato'))

plot_ctr_diff_in_pop_groups(year = params$year,
                            country_asylum_iso3c = params$country,
                            pop_type = c("REF", "ASY")   ) -> p
dml(ggobj = p, fonts = list(serif = 'Lato')) 

plot_ctr_pyramid(year = params$year,
                 country_asylum_iso3c  = params$country,
                            pop_type = c(  "REF") )-> p

dml(ggobj = p, fonts = list(serif = 'Lato'))

plot_ctr_pyramid(year = params$year,
                 country_asylum_iso3c  = params$country,
                            pop_type = c(  "ASY") ) -> p

dml(ggobj = p, fonts = list(serif = 'Lato'))

Maps


plot_ctr_location(year = params$year,
                 country_asylum_iso3c  = params$country,
                 pop_type = c("ASY", "REF", "OIP"),
                 mapbackground = "osm" #  could be "stamen-toner" , "stamen-terrain","stamen-watercolor"
                 ) -> p

dml(ggobj = p, fonts = list(serif = 'Lato'))

Refugee Recognition Determination


plot_ctr_recognition(year = params$year,
                    country_asylum_iso3c  = params$country,
                    top_n_countries = 10, 
                    measure = "RefugeeRecognitionRate",
                                 order_by = "TotalDecided" )-> p
dml(ggobj = p, fonts = list(serif = 'Lato'))

plot_ctr_recognition(year = params$year,
                    country_asylum_iso3c  = params$country,
                    top_n_countries = 10, 
                    measure = "TotalRecognitionRate",
                                 order_by = "Recognized" )-> p
dml(ggobj = p, fonts = list(serif = 'Lato'))

plot_ctr_asylum(year = params$year,
                country_asylum_iso3c  = params$country, 
                lag = 10)-> p
dml(ggobj = p, fonts = list(serif = 'Lato'))

plot_ctr_process(year = params$year,
                country_asylum_iso3c  = params$country)-> p
dml(ggobj = p, fonts = list(serif = 'Lato'))

plot_ctr_processing_time(year = params$year,
                              country_asylum_iso3c = params$country)-> p
dml(ggobj = p, fonts = list(serif = 'Lato'))

Durable Solutions


plot_ctr_solution(year = params$year,
                  country_asylum_iso3c  = params$country,
                  pop_type = c("REF", "ASY"))-> p
dml(ggobj = p, fonts = list(serif = 'Lato'))

Forced Displacement and Migration


## What are the main countries of Destination of Asylum of Forced Displacement across Borders?

plot_ctr_destination(year = params$year,
                     country_origin_iso3c = params$country,
                     pop_type = c("REF", "ASY")
         ) -> p
dml(ggobj = p, fonts = list(serif = 'Lato'))

plot_ctr_origin_recognition(year = params$year,
                     country_origin_iso3c = params$country,
                     top_n_countries = 10,
                     measure = "RefugeeRecognitionRate",
                     order_by = "TotalDecided" ) -> p
dml(ggobj = p, fonts = list(serif = 'Lato'))

plot_ctr_origin_recognition(year = params$year,
                     country_origin_iso3c = params$country,
                     top_n_countries = 10,
                     measure = "TotalRecognitionRate",
                     order_by = "Recognized" ) -> p
dml(ggobj = p, fonts = list(serif = 'Lato'))

plot_ctr_disp_migrant(year = params$year,
                     country_asylum_iso3c  = params$country ) -> p
dml(ggobj = p, fonts = list(serif = 'Lato'))

Next...

The charts from this slide deck constitute a chart library can be used and re-used in reports, talking points and social medias. The charts are in vector formats and can be easily imported in specialized publication software (like Adobe, Publisher or Inkscape).

You may enhance the charts story-telling ability by adjusting the message in the title, highlighting specific parts of the data or adding annotation to ease interpretation or provide more contextual background.

You can contribute to this data literacy product by reporting potential issues you may have detected, asking questions or sharing ideas for new charts to be included.



Edouard-Legoupil/unhcrdatapackage documentation built on Nov. 6, 2023, 6:10 p.m.