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) # copy this part only if you don't have it yet | |
pop <- tibble(year = rep(2023, 5), | |
coa = c("Sudan", "Burkina Faso", "DRC", "Syria", "Yemen"), | |
pop = c(47.5, 22.9, 103.2, 22.1, 33.7), | |
idp = c(9.1, 2.3, 6.3, 7.2, 4.5)) |
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(httr2) | |
library(cli) | |
url <- 'https://dtmapi.iom.int/api/IdpAdmin2Data/GetAdmin2Data' | |
payload <- list(operation = "", | |
countryName = "Afghanistan", | |
admin0Pcode = "", | |
reportingDate = list(fromDate = "2018-12-31", toDate = "2023-05-31"), |
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
up_brewer <- function(pik, eps = 1e-06) { | |
if (any(is.na(pik))) | |
stop("there are missing values in the pik vector") | |
list <- pik > eps & pik < 1 - eps | |
pikb <- pik[list] | |
s <- pik | |
N <- as.integer(length(pikb)) | |
sb <- vector(mode = "double", length = N) | |
r <- .C("C_up_brewer", pikb, N, result = sb) | |
s[list] <- r$result |
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" |
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() |
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" |
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") |> |
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 |
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) |
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. |
NewerOlder