Title: | Private Configuration for 'R' Packages |
Version: | 2.0.3 |
Author: | Gábor Csárdi |
Maintainer: | Gábor Csárdi <csardi.gabor@gmail.com> |
Description: | Set configuration options on a per-package basis. Options set by a given package only apply to that package, other packages are unaffected. |
License: | MIT + file LICENSE |
LazyData: | true |
Imports: | utils |
Suggests: | covr, testthat, disposables (≥ 1.0.3) |
URL: | https://github.com/r-lib/pkgconfig#readme |
BugReports: | https://github.com/r-lib/pkgconfig/issues |
Encoding: | UTF-8 |
NeedsCompilation: | no |
Packaged: | 2019-09-22 08:42:40 UTC; gaborcsardi |
Repository: | CRAN |
Date/Publication: | 2019-09-22 09:20:02 UTC |
Persistent configuration for R packages
Description
This package is meant to be used in other packages, and provides configuration options for them.
Details
It is currently very minimal, and has two main functions: one
for setting configuration options (set_config
), and one
for querying them (get_config
).
Query a configuration parameter key
Description
Query a configuration parameter key, and return the value set in the calling package(s).
Usage
get_config(key, fallback = NULL)
Arguments
key |
The name of the parameter to query. |
fallback |
Fallback if the parameter id not found anywhere. |
Details
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
.
Value
The value of the parameter, or the fallback value if not found.
Set a configuration parameter
Description
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.
Usage
set_config(...)
Arguments
... |
Parameters to set, they should be all named. |
Value
Nothing.
See Also
Set a configuration parameter for a package
Description
This is a more flexible variant of link{set_config}
,
and it allows creating an custom API in the package that
uses pkgconfig
for its configuration.
Usage
set_config_in(..., .in = parent.frame())
Arguments
... |
Parameters to set, they should be all named. |
.in |
An environment, typically belonging to a package. |
Details
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.
Value
Nothing.