On Thu, 25 Dec 2008, Terry Therneau wrote:
> In a few of my test scripts for the survival code I expect warning
messages
> (I actually try to trigger a couple). Using R BATCH infile outfile these
> messages don't end up in outfile, where I can compare them to what was
> expected. I don't see an option to change this.
I don't see this:
tystie% cat infile
2+3
warning("test of warning")
4+5
tystie% cat outfile
R version 2.8.1 (2008-12-22)
Copyright (C) 2008 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> 2+3
[1] 5> warning("test of warning")
Warning message:
test of warning> 4+5
[1] 9>
>
> proc.time()
user system elapsed
0.314 0.037 0.346
so the asked-for reproducible example, please.
> R < infile >& outfile works.
In [t]csh, I presume. BATCH uses 2>1%, the sh equivalent.
> But is there a way to get it to continue on after errors?
options(error=expression(NULL))
as given in the help for stop().
--
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