From xie at yihui.name  Sat Mar  9 22:32:21 2013
From: xie at yihui.name (Yihui Xie)
Date: Sat, 9 Mar 2013 15:32:21 -0600
Subject: [Rd] Why cannot `Rscript -e` accept an empty line?
Message-ID: <CANROs4c10oLkEmroi34oWTH=0zujNWgFxwLAGaa_rMemimPHZQ@mail.gmail.com>

See the example below (under Ubuntu):

$ Rscript -e '1' -e '2'
[1] 1
[1] 2
$ Rscript -e '1' -e '' -e '2'
ERROR: option '-e' requires an argument
$ uname -a
Linux xie 3.5.0-25-generic #39-Ubuntu SMP Mon Feb 25 18:26:58 UTC 2013
x86_64 x86_64 x86_64 GNU/Linux

Similar problem under Windows:

Rscript -e "1" -e "" -e "2"
[1] 1
Error: object 'e' not found
Execution halted

I can certainly save the code in a script and run Rscript foo.R, but
I'm curious why Rscript stops when the -e argument is an empty string.

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA



[Rd] Why cannot `Rscript -e` accept an empty line?
Yihui Xie