Re: R-alpha: R reading stdin -- "save workspace ?" problem

Martin Maechler (
Mon, 25 Mar 1996 16:46:43 +0100

Date: Mon, 25 Mar 1996 16:46:43 +0100
Message-Id: <>
From: Martin Maechler <>
Subject: Re: R-alpha:  R reading  stdin -- "save workspace ?" problem

>>>>> "Ross" == Ross Ihaka <> writes:

    Ross> Martin Maechler writes:
    >> Try the following in your Unix shell:
    >> echo 'license()' | R
    >> (and be ready to press C-z (control Z) since C-c does not work for
    >> me.
    >> The same problem when you try
    >> R < some_input_file > output_file
    >> This shouldn't be too hard to fix, I believe.

    Ross> [ If you haven't tried this -- it causes the question of whether
    Ross> you want your data saved to be raised rather relentlessly ].

    Ross> When we have a Unix Gui, the problem will go away.  You won't be
    Ross> able to invoke R this way ... :-)

    Ross> We tend to think cross-platform on issues like this and aim at
    Ross> the lowest common denominator.  Since the Mac doesn't have a
    Ross> command line interface you can't pipe input to a program.  We
    Ross> thus haven't addressed the issue.

Hmm, hmm.  Let me be a bit a sarcastic:
	Just because the Mac lacks something,
	why should 'R' do so on a Unix platform ?

Reading from  stdin  and  writing to  stdout
is such a powerful concept in Unix,
I'd really miss it if R couldn't provide it.

    Ross> In fact low-level issues like how input is delivered to the
    Ross> parser are very much in a temporary state and I wouldn't want to
    Ross> put too much work into it until we really have a workable
    Ross> cross-platform design.

okay, this is clear.

    Ross> What we could do simply (i.e. for 0.4) is assume either a yes or
    Ross> no response do the "Do you want to save your data?" question if
    Ross> an EOF happens.  Should the assumed response be "yes" or "no".

I'd vote for 'yes'.

However I'd like to be able to override the 'yes':

1) Going further the  "command line road", one could consider a command
   line option , as

	R < FOO.R		will save 
	R -save < FOO.R		will save 

	R -nosave < FOO.R	will not save

2) In addition, I'd like the  q(.) function
   to look like this:

	q <- function(save = "ask") { ...... }

   where ask can be  'yes',  'no', and  'ask' and 
   defaults  to  'ask', the behavior currently used.


What do you think ?
r-testers mailing list -- To (un)subscribe, send
subscribe	or	unsubscribe
(in the "body", not the subject !)  To: