R-alpha: batch

Jim Lindsey jlindsey@luc.ac.be
Wed, 12 Nov 1997 10:17:52 +0100 (MET)


Back to my favourite R subject: batch mode. Some months ago, I pointed
out how the default of saving .RData automatically in batch can often
lead to completely erroneous results when using data.frames. Basically
the idea of .RData is to save the environment to start where one left
off. This will generally be quite different than where one started
the session. The idea of a batch file is to redo a session and create
hard copy of it. Hence one wants to start at the beginning, not the
end. So a .RData file must absolutely not be present. The same holds
if you run a batch file twice. The first time it must not create an
.RData. Otherwise, completely wrong results can be produced the second
time.
  Martin suggested a work around by having a final line in each file
that tests for interactive. This is fine if you remember to put it in
all files. Here is an example of a further problem that hit me the
other day. I am developing some new libraries containing C code. At a
certain point, I wanted hard copy, from batch, before changing the C
to compare before and after. My file has a library call in it (but I
forgot the test on the last line). I ran the batch then went back to
interactive. When I loaded the library and tried to run the C code, it
said that it was not in the load table. Because I was debugging, it
took me quite awhile to discover that the problem was the .RData
created behind my back.
  When is the default going to be changed to not saving the .RData in
batch mode???? Does anyone use batch mode except me?
  Jim
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=