[R] Rscript silent failures with unmatched brackets

Luke Moryl elmoryl at gmail.com
Thu Feb 26 20:03:22 CET 2015


Hi all,

I’ve noticed that a script with unmatched brackets of any sort will fail
silently in Rscript—neither logging nor any output in the shell indicates
that anything went wrong. Example file to run in Rscript:

sink('/tmp/exampleoutfile')
a <- 0
{
  print(a)

Replacing the ‘{‘ with any other symbol that must be matched (quotes,
parens, etc.) results in the same kind of silent failure. One workaround is
to use

echo "source('myscript.R')" | R --no-save --no-restore

from the command line but that’s a kludge. My apologies if this has been
brought up before, but doing a quick search I didn’t find anything, and to
me this seems like a significant bug.

Thanks & best,
Luke
​

	[[alternative HTML version deleted]]



More information about the R-help mailing list