Title: | Private Configuration for 'R' Packages |
---|---|
Description: | Set configuration options on a per-package basis. Options set by a given package only apply to that package, other packages are unaffected. |
Authors: | Gábor Csárdi [aut, cre], Posit Software, PBC [cph, fnd] |
Maintainer: | Gábor Csárdi <[email protected]> |
License: | MIT + file LICENSE |
Version: | 2.0.3 |
Built: | 2024-12-09 06:30:28 UTC |
Source: | https://github.com/r-lib/pkgconfig |
Query a configuration parameter key, and return the value set in the calling package(s).
get_config(key, fallback = NULL)
get_config(key, fallback = NULL)
key |
The name of the parameter to query. |
fallback |
Fallback if the parameter id not found anywhere. |
This function is meant to be called from the package whose behavior depends on it. It searches for the given configuration key, and if it exists, it checks which package(s) it was called from and returns the configuration setting for that package.
If the key is not set in any calling package, but it is set in the global environment (i.e. at the R prompt), then it returns that setting.
If the key is not set anywhere, then it returns NULL
.
The value of the parameter, or the fallback value if not found.
Set a configuration parameter, for the package we are calling from. If called from the R prompt and not from a package, then it sets the parameter for global environment.
set_config(...)
set_config(...)
... |
Parameters to set, they should be all named. |
Nothing.
This is a more flexible variant of set_config
,
and it allows creating an custom API in the package that
uses pkgconfig
for its configuration.
set_config_in(..., .in = parent.frame())
set_config_in(..., .in = parent.frame())
... |
Parameters to set, they should be all named. |
.in |
An environment, typically belonging to a package. |
This function is identical to set_config
, but it allows
supplying the environment that is used as the package the configuration
is set for. This makes it possible to create an API for setting
(and getting) configuration parameters.
Nothing.