-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
73 lines (58 loc) · 2.09 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# unhcrdataportal
<!-- badges: start -->
[![R-CMD-check](https://github.com/Edouard-Legoupil/unhcrdataportal/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/Edouard-Legoupil/unhcrdataportal/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->
The goal of unhcrdataportal is to retrieve data from UNHCR Data Portal within an R session.
Retrieving this data allows to perform quick quality assurance control.
## Installation
You can install the development version of unhcrdataportal from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("Edouard-Legoupil/unhcrdataportal")
```
Note that if you are on windows, you will need to have Rtools installed on your machine
## Example
This is a basic example
```{r example}
library(unhcrdataportal)
## basic example code
page = "Sudan situation"
datasitpop <- odp(page = page,
dataset = "population") |>
## extract the data
purrr::map( "data") |>
## Bind together in a data frame
purrr::list_rbind()
library(ggplot2)
datasitpop |>
ggplot() +
geom_col(aes(x = as.integer(individuals),
y = reorder( glue::glue("{population_group_name} \n as of {date}"),
as.integer(individuals) )),
fill = unhcrthemes::unhcr_pal(n = 1, "pal_blue"),
width = 0.8) +
labs(title = paste0(page),
x = "Number of people",
y = "",
caption = "Source: https://data.unhcr.org/en/situations \n
© UNHCR, The UN Refugee Agency") +
scale_x_continuous(expand = expansion(c(0, 0.1)),
breaks = scales::pretty_breaks(n = 7),
labels = scales::label_number(scale_cut = scales::cut_short_scale())) +
unhcrthemes::theme_unhcr(
font_size = 12,
grid = "X",
axis = "y")
```