Package 'pkgconfig'

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

Help Index


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_config_in


Set a configuration parameter for a package

Description

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.

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.

See Also

set_config