```{css, echo=FALSE} .col-ruler { column-rule: 2px solid #0072bc; column-gap: 30px; }
.center { text-align: center; }
```r # `r paste0(params$country, " - ",params$year) ` knitr::opts_chunk$set(echo = FALSE, comment = "#>", message=FALSE, warning=FALSE, fig.width = 6.3, fig.height = 4.4, fig.retina = 2, fig.align = "center", fig.showtext = TRUE, dev = "ragg_png", dpi = 300) library(testthat) library(ggplot2) library(unhcrthemes) ## 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) theme_set( unhcrthemes::theme_unhcr())
## Key figures can be highlighterd with icons https://fontawesome.com/icons/categories/humanitarian total_poc <- ForcedDisplacementStat::end_year_population_totals_long |> dplyr::filter(Year == params$year, CountryAsylumCode == params$country) |> dplyr::summarise(sum(Value, na.rm = TRUE)) |> dplyr::pull() total_ref <- ForcedDisplacementStat::end_year_population_totals_long |> dplyr::filter(Year == params$year, CountryAsylumCode == params$country, Population.type == "REF" ) |> dplyr::summarise(sum(Value, na.rm = TRUE)) |> dplyr::pull() total_idp <- ForcedDisplacementStat::end_year_population_totals_long |> dplyr::filter(Year == params$year, CountryAsylumCode == params$country, Population.type == "IDP" ) |> dplyr::summarise(sum(Value, na.rm = TRUE)) |> dplyr::pull() total_asy <- ForcedDisplacementStat::end_year_population_totals_long |> dplyr::filter(Year == params$year, CountryAsylumCode == params$country, Population.type == "ASY" ) |> dplyr::summarise(sum(Value, na.rm = TRUE)) |> dplyr::pull() total_ooc <- ForcedDisplacementStat::end_year_population_totals_long |> dplyr::filter(Year == params$year, CountryAsylumCode == params$country, Population.type == "OOC" ) |> dplyr::summarise(sum(Value, na.rm = TRUE)) |> dplyr::pull() total_oip <- ForcedDisplacementStat::end_year_population_totals_long |> dplyr::filter(Year == params$year, CountryAsylumCode == params$country, Population.type == "OIP" ) |> dplyr::summarise(sum(Value, na.rm = TRUE)) |> dplyr::pull() total_sta <- ForcedDisplacementStat::end_year_population_totals_long |> dplyr::filter(Year == params$year, CountryAsylumCode == params$country, Population.type == "STA" ) |> dplyr::summarise(sum(Value, na.rm = TRUE)) |> dplyr::pull() total_poc_last_year <- ForcedDisplacementStat::end_year_population_totals_long |> dplyr::filter(Year == as.numeric(params$year)-1, CountryAsylumCode == params$country) |> dplyr::summarise(sum(Value, na.rm = TRUE)) |> dplyr::pull() perc_change_poc <- ((total_poc - total_poc_last_year)/total_poc_last_year)*100 ref_asy__last_year <- ForcedDisplacementStat::end_year_population_totals_long |> dplyr::filter(Year == as.numeric(params$year)-1, CountryAsylumCode == params$country, Population.type == "REF" | Population.type == "ASY" ) |> dplyr::summarise(sum(Value, na.rm = TRUE)) |> dplyr::pull() perc_change_asy_ref <- (( (total_ref + total_asy) - ref_asy__last_year)/ref_asy__last_year)*100 top_ref <- ForcedDisplacementStat::end_year_population_totals_long |> dplyr::filter(Year == params$year, CountryAsylumCode == params$country, Population.type == "REF") |> dplyr::group_by(CountryOriginName) |> dplyr::summarise(Value = sum(Value, na.rm = TRUE)) |> dplyr::arrange(desc(Value)) |> dplyr::mutate(perc = scales::percent( Value / sum(Value), accuracy = 1.5, trim = FALSE )) |> dplyr::slice(1:3) top_asy <- ForcedDisplacementStat::end_year_population_totals_long |> dplyr::filter(Year == params$year, CountryAsylumCode == params$country, Population.type == "ASY") |> dplyr::group_by(CountryOriginName) |> dplyr::summarise(Value = sum(Value, na.rm = TRUE)) |> dplyr::arrange(desc(Value)) |> dplyr::mutate(perc = scales::percent( Value / sum(Value), accuracy = 1.5, trim = FALSE )) |> dplyr::slice(1:3)
r params$countryname
:::: {.col2 .col-ruler style="display: flex;"}
::: {.column width="50%"}
::: {.left data-latex=""}
[r format(round(total_ref, 0), big.mark=",")
]{.blue .lead} Refugees
[r format(round(total_asy, 0), big.mark=",")
]{.blue .lead} Asylum-seekers
[r format(round(total_ooc, 0), big.mark=",")
]{.blue .lead} *Others of Concerns
:::
:::
::: {.column width="50%"}
::: {.left data-latex=""}
[r format(round(total_oip, 0), big.mark=",")
]{.blue .lead} Other people in need of international protection
[r format(round(total_idp, 0), big.mark=",")
]{.blue .lead} Internally displaced people
[r format(round(total_sta, 0), big.mark=",")
]{.blue .lead} Stateless People
:::
:::
::::
# plot_ctr_treemap(year = params$year, country_asylum_iso3c = params$country, pop_type = c("REF", "ASY", "DIP","OOC", "STA", "OIP") )
\newpage
::: {.bg-blue}
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 = params$year, lag = 5, country_asylum_iso3c = params$country, pop_type = c("REF", "ASY", "OIP", "OOC", "STA", "IDP" ))
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).
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))
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))
plot_ctr_diff_in_pop_groups(year = params$year, country_asylum_iso3c = params$country, pop_type = c("REF", "ASY") )
# plot_ctr_origin_history(year = params$year, country_asylum_iso3c = params$country, lag = 5, pop_type = c("REF", "ASY", "OIP", "IDP" ), otherprop = .02)
# plot_ctr_pyramid(year = params$year, country_asylum_iso3c = params$country, pop_type = c("REF" ) )
# plot_ctr_pyramid(year = params$year, country_asylum_iso3c = params$country, pop_type = c( "ASY") )
plot_ctr_recognition(year = params$year, country_asylum_iso3c = params$country, top_n_countries = 10, measure = "RefugeeRecognitionRate", order_by = "TotalDecided" )
plot_ctr_recognition(year = params$year, country_asylum_iso3c = params$country, top_n_countries = 10, measure = "TotalRecognitionRate", order_by = "Recognized" )
plot_ctr_asylum(year = params$year, country_asylum_iso3c = params$country, lag = 10)
plot_ctr_process(year = params$year, country_asylum_iso3c = params$country)
plot_ctr_processing_time(year = params$year, country_asylum_iso3c = params$country)
plot_ctr_solution(year = params$year, country_asylum_iso3c = params$country, pop_type = c("REF", "ASY"))
r params$countryname
?plot_ctr_disp_migrant(year = params$year, country_asylum_iso3c = params$country )
r params$countryname
?plot_ctr_destination(year = params$year, country_origin_iso3c = params$country, pop_type = c("REF", "ASY") )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.