Skip to content

Instantly share code, notes, and snippets.

# PROJECT: agitprop
# PURPOSE: site count of USAID supported facilities
# AUTHOR: A.Chafetz | USAID
# REF ID: 74bbe262
# LICENSE: MIT
# DATE: 2024-12-02
# UPDATED:
# NOTE: based on https://github.com/USAID-OHA-SI/agitprop/blob/main/Scripts/archive/02_usaid_sites.R
# DEPENDENCIES ------------------------------------------------------------
# PROJECT:
# PURPOSE: QC ZIM 3rd 95
# AUTHOR: A.Chafetz | USAID
# REF ID: d3dbf219
# LICENSE: MIT
# DATE: 2024-09-10
# UPDATED:
# DEPENDENCIES ------------------------------------------------------------
#storing a list of vectors and matching against them
library(tidyverse)
#create file name for dummy dataset outputs
set.seed(42)
files <- sample(fruit, 3) %>%
map_chr(~str_glue("{tempdir()}\\{.x}.csv"))
#create three dummy datasets
tibble(a = runif(5),
gen_json <- function(pal_num, folderpath_out = NULL){
v_pal <- names(glitr::si_palettes[pal_num])
l_col <- glitr::si_palettes[pal_num] |>unlist()
v_col <- glue::glue('"{l_col}"') |> glue::glue_collapse(sep = ', ')
glue::glue('"{v_pal}": [{v_col}],\n')
library(tidyverse)
library(glamr)
library(gophr)
#path to the file
msd_path <- si_path() %>%
return_latest("TRAINING")
#get medata from MSD (idnetify FY and Qtr)
# PROJECT:
# PURPOSE: rube goldberg in ggplot
# AUTHOR: A.Chafetz | USAID
# REF ID: ea15d69e
# LICENSE: MIT
# DATE: 2024-07-18
# UPDATED:
# DEPENDENCIES ------------------------------------------------------------
# PROJECT: dexters_laboratory
# PURPOSE:
# AUTHOR: A.Chafetz | USAID
# REF ID: daee2cf4
# LICENSE: MIT
# DATE: 2024-04-16
# UPDATED:
# DEPENDENCIES ------------------------------------------------------------
#Demonstrating datapasta plugin
#https://milesmcbain.github.io/datapasta/
# INSTALL -----------------------------------------------------------------
# install.packages("datapasta",
# repos = c(mm = "https://milesmcbain.r-universe.dev",
# getOption("repos")))
# PROJECT:
# PURPOSE:
# AUTHOR: A.Chafetz | USAID
# REF ID: 97a36055
# LICENSE: MIT
# DATE: 2024-03-19
# UPDATED:
# DEPENDENCIES ------------------------------------------------------------
export_plot <- function(name){
{name} %>%
paste0(c(".png", ".svg")) %>%
as_tibble_col(column_name = "file") %>%
mutate(folder = c("Images", "Graphics")) %>%
pwalk(~si_save(..1, path = ..2))
}