Skip to content

Commit

Permalink
rev
Browse files Browse the repository at this point in the history
  • Loading branch information
Edouard-Legoupil committed Feb 23, 2024
1 parent 72fa9b8 commit 79cedb3
Show file tree
Hide file tree
Showing 20 changed files with 27 additions and 41 deletions.
15 changes: 7 additions & 8 deletions R/show_budget_gap.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
#' @examples
#' show_budget_gap(year = 2018,
#' ctr_name = "Brazil")
#'
#'
#'
#' show_budget_gap(year = 2018,
#' ctr_name = "Brazil",
#' weight_by = c("refugees", "oip"))
Expand Down Expand Up @@ -121,8 +118,9 @@ show_budget_gap <- function(year,
dplyr::left_join(ctrstat |>
dplyr::select(year, weight) , by = c("year")) |>
dplyr::mutate(budget_value = round(budget_value / weight,1),
transaction_value = round(transaction_value / weight,1))|>
dplyr::mutate(budget_gap = (budget_value - transaction_value) / budget_value *100)
transaction_value = round(transaction_value / weight,1))
df2 <- df2 |>
dplyr::mutate(budget_gap2 = (budget_value - transaction_value) / budget_value *100)

}

Expand All @@ -145,9 +143,10 @@ show_budget_gap <- function(year,
color = "Budget"),
linewidth = 1.5,
color = "#F592A0") +
ggplot2::scale_y_continuous(
expand = ggplot2::expansion(mult = c(0, .1)),
labels = scales::label_number(scale_cut = scales::cut_short_scale()) ) +
ggplot2::scale_y_continuous( limits=c(0,100)) +
# ggplot2::scale_y_continuous(
# #expand = ggplot2::expansion(mult = c(0, .1)),
# labels = scales::label_number(scale_cut = scales::cut_short_scale()) ) +
# scale_x_continuous(labels = scales::label_number(scale_cut = cut_short_scale())) +
# ggplot2::facet_wrap(~ trans_year) +
unhcrthemes::theme_unhcr(grid = "Y", axis = "X",
Expand Down
10 changes: 5 additions & 5 deletions R/show_indicators_time.R
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ show_indicators_time <- function(year,
shape = 17,
size = 3) +
ggplot2::stat_summary(fun.data=mean_sdl, #mult=1,
geom="pointrange", color="grey", size = 3) +
geom="pointrange", color="grey", size = 1) +
geom_hline(yintercept= 0, color="red") +
# ggplot2::scale_color_viridis_d(option = "inferno", na.value = "grey50") +
ggplot2::scale_colour_brewer(palette = "Paired") +
Expand All @@ -230,9 +230,9 @@ show_indicators_time <- function(year,
paste0( result_type_name, " Indicators ",
programme_lab, ctr_name,iati_identifier_ops ) ,
100),
subtitle = stringr::str_wrap( paste0(
"Deviation between reported \"Actual\" value and programmatic \"Target\" (in %)" ) ,
110),
subtitle = stringr::str_wrap( paste0(
"Progress comparison between \"Actual\" reported value and their \"baseline\" (in %)" ) ,
110),
caption = stringr::str_wrap(
"Data Source: UNHCR IATI (International Aid Transparency Initiative)" ,
110) )
Expand Down Expand Up @@ -270,7 +270,7 @@ show_indicators_time <- function(year,
shape = 17,
size = 3) +
ggplot2::stat_summary(fun.data=mean_sdl, #mult=1,
geom="pointrange", color="grey", size = 3) +
geom="pointrange", color="grey", size = 1) +
geom_hline(yintercept= 0, color="red") +
# ggplot2::scale_color_viridis_d(option = "inferno", na.value = "grey50") +
ggplot2::scale_colour_brewer(palette = "Paired") +
Expand Down
25 changes: 12 additions & 13 deletions dev/dev_unhcr_programme.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -824,8 +824,9 @@ show_budget_gap <- function(year,
dplyr::left_join(ctrstat |>
dplyr::select(year, weight) , by = c("year")) |>
dplyr::mutate(budget_value = round(budget_value / weight,1),
transaction_value = round(transaction_value / weight,1))|>
dplyr::mutate(budget_gap = (budget_value - transaction_value) / budget_value *100)
transaction_value = round(transaction_value / weight,1))
df2 <- df2 |>
dplyr::mutate(budget_gap2 = (budget_value - transaction_value) / budget_value *100)
}
Expand All @@ -848,9 +849,10 @@ show_budget_gap <- function(year,
color = "Budget"),
linewidth = 1.5,
color = "#F592A0") +
ggplot2::scale_y_continuous(
expand = ggplot2::expansion(mult = c(0, .1)),
labels = scales::label_number(scale_cut = scales::cut_short_scale()) ) +
ggplot2::scale_y_continuous( limits=c(0,100)) +
# ggplot2::scale_y_continuous(
# #expand = ggplot2::expansion(mult = c(0, .1)),
# labels = scales::label_number(scale_cut = scales::cut_short_scale()) ) +
# scale_x_continuous(labels = scales::label_number(scale_cut = cut_short_scale())) +
# ggplot2::facet_wrap(~ trans_year) +
unhcrthemes::theme_unhcr(grid = "Y", axis = "X",
Expand All @@ -871,9 +873,6 @@ show_budget_gap <- function(year,
```{r example-show_budget_gap, message=FALSE, warning=FALSE, fig.retina = 2, fig.width = 8, fig.asp = 0.618, fig.align = "center", out.width = "90%"}
show_budget_gap(year = 2018,
ctr_name = "Brazil")
show_budget_gap(year = 2018,
ctr_name = "Brazil",
weight_by = c("refugees", "oip"))
Expand Down Expand Up @@ -1820,7 +1819,7 @@ show_indicators_time <- function(year,
shape = 17,
size = 3) +
ggplot2::stat_summary(fun.data=mean_sdl, #mult=1,
geom="pointrange", color="grey", size = 3) +
geom="pointrange", color="grey", size = 1) +
geom_hline(yintercept= 0, color="red") +
# ggplot2::scale_color_viridis_d(option = "inferno", na.value = "grey50") +
ggplot2::scale_colour_brewer(palette = "Paired") +
Expand All @@ -1841,9 +1840,9 @@ show_indicators_time <- function(year,
paste0( result_type_name, " Indicators ",
programme_lab, ctr_name,iati_identifier_ops ) ,
100),
subtitle = stringr::str_wrap( paste0(
"Deviation between reported \"Actual\" value and programmatic \"Target\" (in %)" ) ,
110),
subtitle = stringr::str_wrap( paste0(
"Progress comparison between \"Actual\" reported value and their \"baseline\" (in %)" ) ,
110),
caption = stringr::str_wrap(
"Data Source: UNHCR IATI (International Aid Transparency Initiative)" ,
110) )
Expand Down Expand Up @@ -1881,7 +1880,7 @@ show_indicators_time <- function(year,
shape = 17,
size = 3) +
ggplot2::stat_summary(fun.data=mean_sdl, #mult=1,
geom="pointrange", color="grey", size = 3) +
geom="pointrange", color="grey", size = 1) +
geom_hline(yintercept= 0, color="red") +
# ggplot2::scale_color_viridis_d(option = "inferno", na.value = "grey50") +
ggplot2::scale_colour_brewer(palette = "Paired") +
Expand Down
5 changes: 1 addition & 4 deletions docs/articles/unhcr-programme.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ pkgdown: 2.0.7
pkgdown_sha: ~
articles:
unhcr-programme: unhcr-programme.html
last_built: 2024-02-22T23:55Z
last_built: 2024-02-23T00:23Z

Binary file modified docs/reference/show_budget_gap-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/reference/show_budget_gap-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions docs/reference/show_budget_gap.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified docs/reference/show_indicators_time-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/reference/show_indicators_time-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/reference/show_indicators_time-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/search.json

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions man/show_budget_gap.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions vignettes/unhcr-programme.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,6 @@ show_expenditure(year = 2018,
```{r example-show_budget_gap, message = FALSE, warning = FALSE, fig.retina = 2, fig.width = 8, fig.asp = 0.618, fig.align = "center", out.width = "90%"}
show_budget_gap(year = 2018,
ctr_name = "Brazil")
show_budget_gap(year = 2018,
ctr_name = "Brazil",
weight_by = c("refugees", "oip"))
Expand Down

0 comments on commit 79cedb3

Please sign in to comment.