Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/DEV' into DEV
Browse files Browse the repository at this point in the history
  • Loading branch information
randrescastaneda committed Jul 5, 2024
2 parents 3823d7a + 22858b3 commit 88429b2
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export(pip_indicators)
export(pip_maddison)
export(pip_metadata)
export(pip_metadata_update)
export(pip_metaregion)
export(pip_missing_data)
export(pip_npl)
export(pip_pce)
Expand Down
54 changes: 54 additions & 0 deletions R/pip_metaregion.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#' Metadata for PIP regions
#'
#' Update or load a dataset with regions.
#'
#' @inheritParams pip_cpi
#' @inheritParams pipfun::load_from_gh
#' @export
pip_metaregion <- function(action = c("update", "load"),
force = FALSE,
maindir = gls$PIP_DATA_DIR,
owner = getOption("pipfun.ghowner"),
branch = c("DEV", "PROD", "main"),
tag = match.arg(branch)
) {
measure <- "metaregion"
action <- match.arg(action)
branch <- match.arg(branch)

if (action == "update") {
mr <- pipfun::load_from_gh(measure = measure,
owner = owner,
branch = branch)


## ............................................................................
## Save data ####

if (branch == "main") {
branch <- ""
}
msrdir <- fs::path(maindir, "_aux", branch, measure) # measure dir
saved <- pipfun::pip_sign_save(
x = mr,
measure = measure,
msrdir = msrdir,
force = force
)
return(invisible(saved))


} else {
df <- load_aux(
maindir = maindir,
measure = measure,
branch = branch
)
return(df)
}

} # end of function




35 changes: 35 additions & 0 deletions man/pip_metaregion.Rd

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

0 comments on commit 88429b2

Please sign in to comment.