[R] The "--slave" option

Martin Maechler m@ech|er @end|ng |rom @t@t@m@th@ethz@ch
Mon Sep 23 16:14:36 CEST 2019

>>>>> Richard O'Keefe 
>>>>>     on Sat, 21 Sep 2019 09:39:18 +1200 writes:

    > Ah, *now* we're getting somewhere.  There is something
    > that *can* be done that's genuinely helpful.
    >> From the R(1) manual page:
    >        -q, --quiet Don't print startup message

    >        --silent Same as --quiet

    >        --slave Make R run as quietly as possible

    > It might have been better to use --nobanner instead of
    > --quiet.  So perhaps

    >     -q, --quiet Don't print the startup message.  This is
    > the only output that is suppressed.

    >     --silent Same as --quiet.  Suppress the startup
    > message only.

    >     --slave Make R run as quietly as possible.  This is
    > for use when running R as a subordinate process.  See
    > "Introduction to Sub-Processes in R"
    > https://cran.r-project.org/web/packages/subprocess/vignettes/intro.html
    > for an example.

Thank you, Stephen and Richard.

I think we (the R Core Team) *can* make the description a bit
more verbose. However, as practically all "--<foo>" descriptions
are fitting in one short line, (and as the 'subprocess' package is just an
extension pkg, and may disappear (and more reasons)) I'd like to
be less verbose than your proposal.

What about

  -q, --quiet		Don't print startup message

  --silent		Same as --quiet

  --slave		Make R run as quietly as possible.  For use when
  			runnning R as sub(ordinate) process. 

If you look more closely, you'll notice that --slave is not much
quieter than --quiet, the only (?) difference being that the
input is not copied and (only "mostly") the R prompt is also not printed.

And from my experiments (in Linux (Fedora 30)), one might even
notice that in some cases --slave prints the R prompt (to stderr?)
which one might consider bogous (I'm not: not wanting to spend
time fixing this platform-independently) :

    --slave :

MM using lynne$ echo '(i <- 1:3)
i*10' | R-3.6.1 --slave --vanilla
> [1] 1 2 3
[1] 10 20 30
MM using lynne$ f=/tmp/Rslave.out$$; echo '(i <- 1:3)
i*10' | R-3.6.1 --slave --vanilla | tee $f
> [1] 1 2 3
[1] 10 20 30
MM using lynne$ cat $f
[1] 1 2 3
[1] 10 20 30

    --quiet :

MM using lynne$ f=/tmp/Rquiet.out$$; echo '(i <- 1:3)
i*10' | R-3.6.1 --quiet --vanilla | tee $f
> (i <- 1:3)
[1] 1 2 3
> i*10
[1] 10 20 30
MM using lynne$ cat $f
> (i <- 1:3)
[1] 1 2 3
> i*10
[1] 10 20 30
MM using lynne$ 


But there's a bit more to it: In my examples above, both --quiet
and --slave where used together with --vanilla.  In general
--slave *also* never saves, i.e., uses the equivalent of
q('no'), where as --quiet does [ask or ...].

Last but not least, from very simply reading R's source code on
this, it becomes blatant that you can use  '-s'  instead of '--slave',
but we (R Core) have probably not documented that on purpose (so
we could reserve it for something more important, and redefine
the simple use of '-s' some time in the future ?)

So, all those who want to restrict their language could use '-s'
for now.  In addition, we could add  >> one <<  other alias to
--slave, say --subprocess (or --quieter ? or ???)
and one could make that the preferred use some time in the future.

Well, these were another two hours of time *not* spent improving
R technically, but spent reading e-mails, source code, and considering.
Maybe well spent, maybe not ...

Martin Maechler
ETH Zurich and R Core Team

    > On Sat, 21 Sep 2019 at 02:29, Stephen Ellison
    > <S.Ellison using lgcgroup.com> wrote:
    >> > Sure, it's a silly example, but it makes about as much
    >> sense as using > "slave" to mean "quiet".  It
    >> doesn't. It's a set of options chosen for when R is
    >> called as a slave process from a controlling process, and
    >> in that it is a reasonable description of the
    >> circumstance.
    >> --quiet is a separate command line option with different
    >> effect.

More information about the R-help mailing list