[Rd] Querying from R if '--quiet' had been set
Martin Maechler
m@ech|er @end|ng |rom @t@t@m@th@ethz@ch
Fri Jun 27 17:21:23 CEST 2025
>>>>> Dirk Eddelbuettel
>>>>> on Fri, 27 Jun 2025 09:22:36 -0500 writes:
> The interactive() predicate is helpful in scripted environments. I sometimes
> also invoke R with '--quiet' and am unable to suppress messages from my own
> startup code as I cannot test if this flag was set or not. (I can work around
> it by setting an additional environment variable, but that is clunky.) For me
> '--quiet' is independent to 'interactive'.
> R carries the state internally in the integer variable R_Quiet, so a minimal
> patch only needs to expose an accessor 'quiet()' model after 'interactive()'.
> Then we get the desired behaviour:
> ~/svn/r-devel$ RD -q
>> quiet()
> [1] TRUE
>>
> and this is similarly FALSE in a normal startup without '-q'.
> Would this change be of interest? The patch is just a few lines (but does
> not yet contain Rd file changes).
As Duncan Murdoch recently explained "here" (in the R mailinglists-verse),
this is indeed a change that only R-core could do .. and I agree
that the change would be relatively small, or rather that most of
the work here would be writing / updating documentation, NEWS, etc.
On the other hand, this functionality has been "implicitly" in R, forever :
> "--quiet" %in% commandArgs()
[1] FALSE
... though I agree that using commandArgs() looks a bit "clunky"
and may not always do the expected thing (embedded use of R; R
Studio / Positron / ....).
What do you think?
Best,
Martin
> Cheers, Dirk
> --
> dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org
More information about the R-devel
mailing list