Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow default options #67

Open
wants to merge 4 commits into
base: DEV
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: pipr
Title: Client for the Poverty and Inequality Platform ('PIP') API
Version: 1.0.0
Version: 1.0.1
Authors@R:
c(person(given = "Tony",
family = "Fujs",
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# pipr 1.0.1

* Introduce setting default values for arguments `table`, `version`, `ppp_version` and `release_version` using `options`

# pipr 1.0.0

* [Mock live API calls or skip them on CRAN](https://github.com/worldbank/pipr/pull/45)
Expand Down
6 changes: 3 additions & 3 deletions R/display_aux.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
#' \dontrun{
#' display_aux()
#' }
display_aux <- function(version = NULL,
ppp_version = NULL,
release_version = NULL,
display_aux <- function(version = getOption("pipr.version"),
ppp_version = getOption("pipr.ppp_version"),
release_version = getOption("pipr.release_version"),
api_version = "v1",
format = c("rds", "json", "csv"),
simplify = TRUE,
Expand Down
86 changes: 43 additions & 43 deletions R/get_aux.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
#' get_aux("gdp", assign_tb = "new_name")
#'
#' }
get_aux <- function(table = NULL,
version = NULL,
ppp_version = NULL,
release_version = NULL,
get_aux <- function(table = getOption("pipr.table"),
version = getOption("pipr.version"),
ppp_version = getOption("pipr.ppp_version"),
release_version = getOption("pipr.release_version"),
api_version = "v1",
format = c("rds", "json", "csv"),
simplify = TRUE,
Expand Down Expand Up @@ -141,9 +141,9 @@ get_aux <- function(table = NULL,
#' # Short hand to get countries
#' get_countries()
#' }
get_countries <- function(version = NULL,
ppp_version = NULL,
release_version = NULL,
get_countries <- function(version = getOption("pipr.version"),
ppp_version = getOption("pipr.ppp_version"),
release_version = getOption("pipr.release_version"),
api_version = "v1",
format = c("rds", "json", "csv"),
server = NULL) {
Expand All @@ -164,9 +164,9 @@ get_countries <- function(version = NULL,
#' # Short hand to get regions
#' get_regions()
#' }
get_regions <- function(version = NULL,
ppp_version = NULL,
release_version = NULL,
get_regions <- function(version = getOption("pipr.version"),
ppp_version = getOption("pipr.ppp_version"),
release_version = getOption("pipr.release_version"),
api_version = "v1",
format = c("rds", "json", "csv"),
server = NULL) {
Expand All @@ -187,9 +187,9 @@ get_regions <- function(version = NULL,
#' # Short hand to get cpi
#' get_cpi()
#' }
get_cpi <- function(version = NULL,
ppp_version = NULL,
release_version = NULL,
get_cpi <- function(version = getOption("pipr.version"),
ppp_version = getOption("pipr.ppp_version"),
release_version = getOption("pipr.release_version"),
api_version = "v1",
format = c("rds", "json", "csv"),
server = NULL) {
Expand All @@ -210,9 +210,9 @@ get_cpi <- function(version = NULL,
#' # Short hand to get dictionary
#' get_dictionary()
#' }
get_dictionary <- function(version = NULL,
ppp_version = NULL,
release_version = NULL,
get_dictionary <- function(version = getOption("pipr.version"),
ppp_version = getOption("pipr.ppp_version"),
release_version = getOption("pipr.release_version"),
api_version = "v1",
format = c("rds", "json", "csv"),
server = NULL) {
Expand All @@ -233,9 +233,9 @@ get_dictionary <- function(version = NULL,
#' # Short hand to get gdp
#' get_gdp()
#' }
get_gdp <- function(version = NULL,
ppp_version = NULL,
release_version = NULL,
get_gdp <- function(version = getOption("pipr.version"),
ppp_version = getOption("pipr.ppp_version"),
release_version = getOption("pipr.release_version"),
api_version = "v1",
format = c("rds", "json", "csv"),
server = NULL) {
Expand All @@ -257,9 +257,9 @@ get_gdp <- function(version = NULL,
#' # Short hand to get incgrp_coverage
#' get_incgrp_coverage()
#' }
get_incgrp_coverage <- function(version = NULL,
ppp_version = NULL,
release_version = NULL,
get_incgrp_coverage <- function(version = getOption("pipr.version"),
ppp_version = getOption("pipr.ppp_version"),
release_version = getOption("pipr.release_version"),
api_version = "v1",
format = c("rds", "json", "csv"),
server = NULL) {
Expand All @@ -283,9 +283,9 @@ get_incgrp_coverage <- function(version = NULL,
#' # Short hand to get interpolated_means
#' get_interpolated_means()
#' }
get_interpolated_means <- function(version = NULL,
ppp_version = NULL,
release_version = NULL,
get_interpolated_means <- function(version = getOption("pipr.version"),
ppp_version = getOption("pipr.ppp_version"),
release_version = getOption("pipr.release_version"),
api_version = "v1",
format = c("rds", "json", "csv"),
server = NULL) {
Expand All @@ -305,9 +305,9 @@ get_interpolated_means <- function(version = NULL,
#' # Short hand to get hfce
#' get_hfce()
#' }
get_hfce <- function(version = NULL,
ppp_version = NULL,
release_version = NULL,
get_hfce <- function(version = getOption("pipr.version"),
ppp_version = getOption("pipr.ppp_version"),
release_version = getOption("pipr.release_version"),
api_version = "v1",
format = c("rds", "json", "csv"),
server = NULL) {
Expand All @@ -327,9 +327,9 @@ get_hfce <- function(version = NULL,
#' # Short hand to get pop
#' get_pop()
#' }
get_pop <- function(version = NULL,
ppp_version = NULL,
release_version = NULL,
get_pop <- function(version = getOption("pipr.version"),
ppp_version = getOption("pipr.ppp_version"),
release_version = getOption("pipr.release_version"),
api_version = "v1",
format = c("rds", "json", "csv"),
server = NULL) {
Expand All @@ -350,9 +350,9 @@ get_pop <- function(version = NULL,
#' # Short hand to get pop_region
#' get_pop_region()
#' }
get_pop_region <- function(version = NULL,
ppp_version = NULL,
release_version = NULL,
get_pop_region <- function(version = getOption("pipr.version"),
ppp_version = getOption("pipr.ppp_version"),
release_version = getOption("pipr.release_version"),
api_version = "v1",
format = c("rds", "json", "csv"),
server = NULL) {
Expand All @@ -373,9 +373,9 @@ get_pop_region <- function(version = NULL,
#' # Short hand to get ppp
#' get_ppp()
#' }
get_ppp <- function(version = NULL,
ppp_version = NULL,
release_version = NULL,
get_ppp <- function(version = getOption("pipr.version"),
ppp_version = getOption("pipr.ppp_version"),
release_version = getOption("pipr.release_version"),
api_version = "v1",
format = c("rds", "json", "csv"),
server = NULL) {
Expand All @@ -395,9 +395,9 @@ get_ppp <- function(version = NULL,
#' # Short hand to get region_coverage
#' get_region_coverage()
#' }
get_region_coverage <- function(version = NULL,
ppp_version = NULL,
release_version = NULL,
get_region_coverage <- function(version = getOption("pipr.version"),
ppp_version = getOption("pipr.ppp_version"),
release_version = getOption("pipr.release_version"),
api_version = "v1",
format = c("rds", "json", "csv"),
server = NULL) {
Expand All @@ -419,9 +419,9 @@ get_region_coverage <- function(version = NULL,
#' # Short hand to get survey_means
#' get_survey_means()
#' }
get_survey_means <- function(version = NULL,
ppp_version = NULL,
release_version = NULL,
get_survey_means <- function(version = getOption("pipr.version"),
ppp_version = getOption("pipr.ppp_version"),
release_version = getOption("pipr.release_version"),
api_version = "v1",
format = c("rds", "json", "csv"),
server = NULL) {
Expand Down
6 changes: 3 additions & 3 deletions R/get_stats.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ get_stats <- function(country = "all",
subgroup = NULL,
welfare_type = c("all", "income", "consumption"),
reporting_level = c("all", "national", "urban", "rural"),
version = NULL,
ppp_version = NULL,
release_version = NULL,
version = getOption("pipr.version"),
ppp_version = getOption("pipr.ppp_version"),
release_version = getOption("pipr.release_version"),
api_version = "v1",
format = c("rds", "json", "csv"),
simplify = TRUE,
Expand Down
6 changes: 3 additions & 3 deletions man/display_aux.Rd

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

Loading