From S.J.Eglen at damtp.cam.ac.uk  Thu Sep  1 13:09:15 2005
From: S.J.Eglen at damtp.cam.ac.uk (Stephen Eglen)
Date: Thu, 1 Sep 2005 12:09:15 +0100
Subject: [Rd] R CMD BATCH on scripts without trailing newline
Message-ID: <17174.57691.868797.92193@notch.amtp.cam.ac.uk>


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



[Rd] R CMD BATCH on scripts without trailing newline
Stephen Eglen