[Rd] R CMD BATCH on scripts without trailing newline

Stephen Eglen S.J.Eglen at damtp.cam.ac.uk
Thu Sep 1 13:09:15 CEST 2005


If the last line of an R script does not have a trailing newline, a
small errror is produced at the end of the script.

Small example.  If file eg.r contains one line:
getwd()
and there is no newline after the closing paren

$ R CMD BATCH eg.r

produces an error:
$ cat eg.r.Rout 

R : Copyright 2005, The R Foundation for Statistical Computing
Version 2.1.1 Patched (2005-09-01), ISBN 3-900051-07-0

...

> getwd()proc.time()
Error: syntax error
Execution halted
$ 

Is it worth changing the BATCH script so that it adds a newline before
adding the call to proc.time()?

Stephen



More information about the R-devel mailing list