Learn R Programming

crunch (version 1.30.4)

envOrOption: Get/set options (user-specified, in environment, or in R options)

Description

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).

Usage

envOrOption(opt, default = NULL, expect_lgl = FALSE, expect_num = FALSE)

set_crunch_opts(..., .source = NULL)

Value

the value of the option

Arguments

opt

the option to get/set

default

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

.source

(Optional) A character vector describing where the option was set from

Details

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 nameEnv variableDefault valueExplanation
crunch.apiR_CRUNCH_API"https://app.crunch.io/api/"URL of API to use
crunch.api.keyR_CRUNCH_API_KEYKey to use to authenticate with crunch (see help('crunch-api-key'))
crunch.show.progressR_CRUNCH_SHOW_PROGRESSTRUEWhether to show progress bars during interactive sessions
crunch.timeoutR_CRUNCH_TIMEOUT900Number of seconds to wait before timing out a request
crunch.show.progress.urlR_CRUNCH_SHOW_PROGRESS_URLFALSEWhether to show the URL when checking progress
crunch_retry_waitR_CRUNCH_RETRY_WAIT0.1Number of seconds to wait before retrying a download
crunch.require.confirmationR_CRUNCH_REQUIRE_CONFIRMATIONTRUEWhether to require confirmation for destructive actions (like delete())
crunch.warn.hiddenR_CRUNCH_WARN_HIDDENTRUEWhether to warn when using a hidden variable
crunch.warn.privateR_CRUNCH_WARN_PRIVATETRUEWhether to warn when using a private variable
crunch.names.includes.hidden.private.variablesR_NAMES_INCLUDES_HIDDEN_PRIVATE_VARIABLESTRUEWhether to include hidden/private variables from names(ds)
crunch.order.var.catalogR_CRUNCH_ORDER_VAR_CATALOGTRUEWhether to set the variable catalog in the order of the hierarchical order
crunch.delimiterR_CRUNCH_DELIMITER"/"What to use as a delimiter when printing folder paths
crunch.check.updatesR_CRUNCH_CHECK_UPDATESTRUEWhether to check for updates to the crunch package
crunch.debugR_CRUNCH_DEBUGFALSEWhether to print verbose information for debugging
test.verify.sslR_TEST_VERIFY_SSLTRUEWhether to verify ssl in curl during crunch tests
crunch.stabilize.queryR_CRUNCH_STABILIZE_QUERYFALSEWhether to stabilize JSON objects for saving as httptest objects
crunch.namekey.datasetR_CRUNCH_NAMEKEY_DATASET"alias"What variable identifier (alias or name) to use for a dataset's variables
crunch.namekey.arrayR_CRUNCH_NAMEKEY_ARRAY"alias"What variable identifier (alias or name) to use for an array's subvariables
crunch.namekey.variableorderR_CRUNCH_NAMEKEY_VARIABLEORDER"name"What variable identifier (alias or name) to use for an order's variables
use.legacy.tabbook.endpointR_USE_LEGACY_TABBOOK_ENDPOINTFALSE(Deprecated) Whether to use legacy tabbook endpoint in tabBook()