View pbs_moe_chart.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(ggpattern) | |
library(ggtext) | |
## https://www.pbs.org/newshour/politics/most-americans-want-congress-to-compromise-as-debt-ceiling-looms | |
## Great chart by Megan McGrew | |
col <- c("#2aa7ff", "#f93037", "#a44bd2", "#c0c1c0") | |
bg_col <- "#ecedec" |
View ridl_regional_dataset_list.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(ridl) | |
library(lubridate) | |
### Targeted region | |
region <- "west-and-central-africa" | |
### List all containers | |
ct_nm <- rc_list() |
View onedriveR.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(Microsoft365R) | |
library(tidyverse) | |
library(readxl) | |
odb <- get_business_onedrive(app = "d44a05d5-c6a5-4bbb-82d2-443123722380") | |
### Check files | |
odb$list_items() | |
### Check files in "Documents" |
View get_ridl_metadata_wca.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(janitor) | |
library(ridl) ## remotes::install_gitlab("dickoa/ridl") | |
library(popdata) ## remotes::install_gitlab("dickoa/popdata") | |
### Get the list of countries name, iso3 and unhcr code | |
ct <- pd_countries | |
ct <- filter(pd_countries, | |
bureau == "West and Central Africa") |> |
View mali_violence_acled.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(sf) | |
library(rgeoboundaries) ## remotes::install_github("wmgeolabs/rgeoboundaries") | |
library(racled) ## remotes::install_gitlab("dickoa/racled") | |
library(cowplot) | |
### Get Mali country boundaries | |
mli_adm0 <- gb_adm0("mali") | |
### Get Mali ACLED data |
View read_kobo_data.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(robotoolbox) # if not available please do remotes::install_gitlab("dickoa/robotoolbox") | |
library(dplyr) | |
library(labelled) | |
token <- kobo_token(username = "xxxx", | |
password = "xxxxx", | |
url = "kobo.humanitarianresponse.info") | |
kobo_setup(url = "kobo.humanitarianresponse.info", | |
token = token) |
View blastula_o365.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(Microsoft365R) | |
library(blastula) | |
outl <- get_business_outlook(app = "d44a05d5-c6a5-4bbb-82d2-443123722380") ## just once after you can do `outl <- get_business_outlook()` | |
body <- "## Hello! | |
This is an email message that was generated by the blastula package. | |
We can use **Markdown** formatting with the `md()` function. |
View demo_popdata.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(popdata) | |
library(unhcrthemes) | |
library(tidyverse) | |
library(janitor) | |
### Most function use "pd_" prefix | |
### "pd" stands for PopData | |
### Log into popdata | |
# pd_login() |
View test_repeat.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' @noRd | |
repeat_to_df <- function(x, form) { | |
nm <- unique(form$name[form$type %in% "begin_repeat"]) | |
nm <- intersect(names(x), nm) | |
if (length(nm) > 0) { | |
x <- lapply(nm, function(n) { | |
res <- x[[n]] | |
res <- res[vapply(res, is.data.frame, logical(1))] | |
res <- rbindlist(res, fill = TRUE) |
View scale_color_fill_nmax.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
remotes::install_github("dickoa/unhcrthemes") | |
library(unhcrthemes) | |
library(ggplot2) | |
library(ragg) | |
### checking scale_color | |
ggplot(iris, aes(x = Petal.Length, y = Petal.Width, color = Species)) + | |
geom_point() + | |
scale_color_unhcr_d(palette = "pal_main_qual") + |
NewerOlder