knitr::opts_chunk$set(
  collapse = TRUE,
  echo=TRUE,
  comment = "#>"
)

Load Packages

library(tidyverse)

Prepare Data

## Loading the stat tables
data <- dplyr::left_join( x= unhcrdatapackage::end_year_population_totals_long, 
                                                     y= unhcrdatapackage::reference, 
                                                     by = c("CountryAsylumCode" = "iso_3")) %>%
  filter(Population.type  == "REF") %>%
  group_by(Year) %>%
  summarise(Value2 = sum(Value) ) 

Generate Plot

#Make plot
ggplot(data, aes(x = Year, y = Value2)) +
  geom_line(colour = "#0072bc", size = 1) + # Here we mention that it will be a line chart
 # geom_hline(yintercept = 0, size = 1, colour = "#333333") +

  unhcRstyle::unhcr_theme(base_size = 9) + ## Insert UNHCR Style
  scale_y_continuous( label = scales::label_number_si()) + ## Format axis number
  ## and the chart labels
  labs(title = "More and More refugees",
       x = "",
       y = "",
       subtitle = "World wide refugee population 1951-2017", 
       caption = "UNHCR https://www.unhcr.org/refugee-statistics/")


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