[Rd] non-interactive R_tryEval does not return

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Feb 21 23:58:04 CET 2007


Yes, this is as expected/documented (in so far as R_tryEval is 
documented: it is not part of the API, as far as I am aware).

Its point is to be the equivalent of submitting an expression from the 
toplevel and returning to the toplevel, without using R_ReadConsole. So it 
behaves in just the same ways as any other R session with respect to 
R errors.

I think in all the intended uses R would be in interactive mode, and I 
suspect it is an oversight that Rf_initEmbeddedR does not set that on 
Unix-alikes (it does on Windows).  You can set R_Interactive afterwards, 
of course.


On Wed, 21 Feb 2007, Martin Morgan wrote:

> ...at least I think that is what happens, at least on some
> configurations. Here's a repeatable example:
>
> cd R_HOME/tests/Embedding
> touch tmp.R
> make tryEval
>
> and then (correct)
>
>> ./tryEval --slave
> Error in sqrt("") : Non-numeric argument to mathematical function
> Caught an error calling sqrt(). Try again with a different argument.
> [1] 3
>
> versus (non-interactive; no return)
>
>> ./tryEval --slave < tmp.R
> Error in sqrt("") : Non-numeric argument to mathematical function
> Execution halted
>
>> echo "sessionInfo()" | R --slave
> R version 2.5.0 Under development (unstable) (2007-02-21 r40774)
> x86_64-unknown-linux-gnu
>
> locale:
> LC_CTYPE=en_US;LC_NUMERIC=C;LC_TIME=en_US;LC_COLLATE=en_US;LC_MONETARY=en_US;LC_MESSAGES=en_US;LC_PAPER=en_US;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US;LC_IDENTIFICATION=C
>
> attached base packages:
> [1] "stats"     "graphics"  "grDevices" "utils"     "datasets"  "methods"
> [7] "base"
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list