[Rd] R-specific environment variables: Naming convention?
Tomas Kalibera
tom@@@k@||ber@ @end|ng |rom gm@||@com
Thu Oct 10 11:00:35 CEST 2019
In principle, what is documented in Writing R Extensions or in the
manual pages of the internal help system is "public", including
environment variables. If it is not documented there, it is not
"public". In addition, the documentation may say that something is
experimental, better avoided, etc, so needs to read the context, not
just "grep" the documentation.
Moreover, it is always better to avoid using environment variables
whenever possible, even the "public" ones, they may interact with child
processes one is not aware of and in unexpected ways (including child
processes spawned by R internally, such as during package checking and
installation). For the same reason they may be set/re-set/cleared when
child processes are spawned. They may interact in unexpected ways when
they impact related things. Debugging issues related to environment
variables is often hard and time consuming.
If an environment variable name starts with _R, it is an indication that
it is not "public", but there may be several inconsistencies. One should
always check the documentation; it is not only about whether the
variable is "public", but also what is the public behavior - and for
that one needs the documentation.
Best
Tomas
On 10/10/19 7:09 AM, Henrik Bengtsson wrote:
> In base R, there are lots of environment variables with either prefix
> 'R_' or '_R_', e.g. R_ENABLE_JIT and _R_RNG_VERSION_. I always
> considered R_* variables to be "public" and _R_*_ ones being
> "internal" but realized I don't have a reference for this. Is this
> true, or is there another reason? Is the difference between the two
> kinds documented anywhere?
>
> Thank you,
>
> Henrik
>
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
More information about the R-devel
mailing list