These functions allow for a consistent framework of options for the
crunch package. When retrieving options, envOrOption()
first
looks for options set with the set_crunch_opts()
, followed by
options in the environment (see Sys.getenv()
)
and finally in the R options (see options
).
envOrOption(opt, default = NULL, expect_lgl = FALSE, expect_num = FALSE)
set_crunch_opts(..., .source = NULL)
the option to get/set
if the specified option is not set in either the option or as an environment variable, use this instead.
Named arguments describing which options to set
(Optional) A character vector describing where the option was set from
the value of the option
Environment variables are generally set at the operating system level,
but R does look at a file called .Renviron
on startup, and you can
also set them using the function Sys.setenv()
. Options are generally
set using a options()
function in the .Rprofile
file, but can be
set using that function anywhere.
The main crunch
R package uses the following options (note that
the option name is in all capital letters, with "." replaced with
"" and a "R" prefix when used as an environment variable):
Option name | Env variable | Default value | Explanation |
crunch.api | R_CRUNCH_API | "https://app.crunch.io/api/" | URL of API to use |
crunch.api.key | R_CRUNCH_API_KEY | Key to use to authenticate with crunch (see help('crunch-api-key') ) | |
crunch.show.progress | R_CRUNCH_SHOW_PROGRESS | TRUE | Whether to show progress bars during interactive sessions |
crunch.timeout | R_CRUNCH_TIMEOUT | 900 | Number of seconds to wait before timing out a request |
crunch.show.progress.url | R_CRUNCH_SHOW_PROGRESS_URL | FALSE | Whether to show the URL when checking progress |
crunch_retry_wait | R_CRUNCH_RETRY_WAIT | 0.1 | Number of seconds to wait before retrying a download |
crunch.require.confirmation | R_CRUNCH_REQUIRE_CONFIRMATION | TRUE | Whether to require confirmation for destructive actions (like delete() ) |
crunch.warn.hidden | R_CRUNCH_WARN_HIDDEN | TRUE | Whether to warn when using a hidden variable |
crunch.warn.private | R_CRUNCH_WARN_PRIVATE | TRUE | Whether to warn when using a private variable |
crunch.delimiter | R_CRUNCH_DELIMITER | "/" | What to use as a delimiter when printing folder paths |
crunch.check.updates | R_CRUNCH_CHECK_UPDATES | TRUE | Whether to check for updates to the crunch package |
crunch.debug | R_CRUNCH_DEBUG | FALSE | Whether to print verbose information for debugging |
test.verify.ssl | R_TEST_VERIFY_SSL | TRUE | Whether to verify ssl in curl during crunch tests |
crunch.stabilize.query | R_CRUNCH_STABILIZE_QUERY | FALSE | Whether to stabilize JSON objects for saving as httptest objects |
crunch.namekey.dataset | R_CRUNCH_NAMEKEY_DATASET | "alias" | What variable identifier (alias or name) to use for a dataset's variables |
crunch.namekey.array | R_CRUNCH_NAMEKEY_ARRAY | "alias" | What variable identifier (alias or name) to use for an array's subvariables |
crunch.namekey.variableorder | R_CRUNCH_NAMEKEY_VARIABLEORDER | "name" | What variable identifier (alias or name) to use for an order's variables |
use.legacy.tabbook.endpoint | R_USE_LEGACY_TABBOOK_ENDPOINT | FALSE | (Deprecated) Whether to use legacy tabbook endpoint in tabBook() |