Last active
March 29, 2020 20:39
-
-
Save jeffeaton/05ca5849b2b3f694dbef758c124adac0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#' This script is an example of the function subset_output_package() to load, | |
#' subset, and resave the Naomi output package. | |
#' | |
#' The arguments to the function are: | |
#' | |
#' * path: file path to the output package. | |
#' * output_path: file path to save the new subsetted package (end in .zip). | |
#' * area_id: vector of area_ids to keep or drop. | |
#' * area_level: vector of area_levels to keep or drop. | |
#' * sex: vector of sexes to keep or drop. | |
#' * age_group: vector of age_groups to keep or drop. | |
#' * calendar_quarter: vector of calendar quarters to keep or drop. | |
#' * indicator: vector of indicators to keep or drop | |
#' * drop: TRUE/FALSE whether to drop the specified stratifications. | |
#' * check_list: TRUE/FALSE check whether specified values are found (optional). | |
library(tidyverse) | |
library(sf) | |
library(zip) | |
source("https://raw.githubusercontent.com/mrc-ide/naomi/subset-output/R/outputs.R") | |
source("https://raw.githubusercontent.com/mrc-ide/naomi/subset-output/R/utils.R") | |
#' Example | |
digest_path <- "naomi_spectrum_digest_d64a7.zip", | |
subset_digest_path <- "nigeria_coarse_age_subset.zip" | |
age_groups_drop <- c("00-04", "05-09", "10-14", "15-19", "20-24", "25-29", "30-34", | |
"35-39", "40-44", "45-49", "50-54", "55-59", "60-64", "65-69", | |
"70-74", "75-79", "80+", "00-00", "01-04") | |
subset_output_package(digest_path, subset_digest_path, | |
age_group = age_groups_drop, | |
drop = TRUE) | |
subset_digest_path <- "nigeria_four_age_subset.zip" | |
age_groups_keep <- c("00-14", "15-24", "15-49", "50+") | |
subset_output_package(digest_path, subset_digest_path, | |
age_group = age_groups_keep, | |
drop = FALSE) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment