-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from USEPA/1-prepare-for-cran-release
1 prepare for cran release
- Loading branch information
Showing
26 changed files
with
323 additions
and
373 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
# ccdR 1.0.0 | ||
# ctxR 1.0.0 | ||
|
||
# ccdR 0.1.0 | ||
* Initial release. Renamed package from `ccdR` package for better alignment | ||
with US EPA CTX APIs. | ||
|
||
* Added a `NEWS.md` file to track changes to the package. | ||
* Initial release. |
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
This file was deleted.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#' ctxR Options | ||
#' | ||
#' ctxR stores options as a named list in R's global options, i.e. | ||
#' `getOption('ctxR')`. It currently stores two such options, one for CCTE | ||
#' credentialing and one to suppress private API information in the URLs printed | ||
#' to the screen when web queries are placed. For both of those, see | ||
#' [register_ctx_api_key()]. | ||
#' | ||
#' @param ... a named listing of options to set | ||
#' @param option a specific option to query, e.g. `display_api_key` | ||
#' @name ctxR_options | ||
#' @returns | ||
#' * `set_ctxR_option()` does not have a return value but has the side effect | ||
#' of setting options used by other functions. | ||
#' | ||
#' * `has_ctxR_option()` returns a Boolean. | ||
#' | ||
#' * `has_ctxR_options()` returns a Boolean. | ||
#' @seealso [register_ctx_api_key()] | ||
#' | ||
#' | ||
#' | ||
|
||
|
||
|
||
|
||
|
||
|
||
#' @rdname ctxR_options | ||
#' @export | ||
#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') | ||
#' # Set ctxR options | ||
#' set_ctxR_option('display_api_key' = FALSE) | ||
set_ctxR_option <- function(...) { | ||
|
||
# if there is no ctxR option create the list with the arguments and return | ||
if (!has_ctxR_options()) { | ||
options('ctxR' = list(...)) | ||
return(invisible()) | ||
} | ||
|
||
# otherwise, go through arguments sequentially and add/update | ||
# them in the list ctxR options | ||
ctxR <- getOption('ctxR') | ||
arg_list <- lapply(as.list(match.call())[-1], eval, envir = parent.frame()) | ||
for (k in seq_along(arg_list)) { | ||
if (names(arg_list)[k] %in% names(ctxR)) { | ||
ctxR[names(arg_list)[k]] <- arg_list[k] | ||
} else { | ||
ctxR <- c(ctxR, arg_list[k]) | ||
} | ||
} | ||
|
||
# set new ctxR | ||
options('ctxR' = ctxR) | ||
|
||
# return | ||
invisible() | ||
} | ||
|
||
|
||
|
||
#' @rdname ctxR_options | ||
#' @export | ||
#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') | ||
#' # Check if there are options registered to 'ctxR' | ||
#' has_ctxR_options() | ||
|
||
has_ctxR_options <- function() { | ||
!is.null(getOption('ctxR')) | ||
} | ||
|
||
#' @rdname ctxR_options | ||
#' @export | ||
#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') | ||
#' # Check if a specific option is registered for 'ctxR' | ||
#' has_ctxR_option('display_api_key') | ||
|
||
has_ctxR_option <- function(option) { | ||
|
||
if (has_ctxR_options()){ | ||
option %in% names(getOption('ctxR')) | ||
} else { | ||
FALSE | ||
} | ||
} |
Oops, something went wrong.