Reputation: 10607
I don't think R CMD BATCH
or Rscript
is supposed to stop on an error, but I would like it to (or something like it).
As an example I have this in test.R
:
stop("I really mean stop!")
cat("no, I dont want this printed")
After running R CMD BATCH test.R
, I get:
> > stop("I really mean stop!") Error: I really mean stop!
> >
> > cat("no, I dont want this printed") no, I dont want this printed>
The cat
command is executed, even though I don't want it to be.
I've discovered a trick to make a file like runTest.R
that contains
source('test.R')
And then if I run R CMD BATCH runTest.R
things work as I like.
But I'm looking for a way that's not a trick and where I don't have to create an extra file.
Upvotes: 1
Views: 1241
Reputation: 10607
If I remove the following from my .Rprofile
I do not have the problem:
options(error = utils::dump.frames)
Thanks to the commenters for helping me figure that out.
Upvotes: 1