Skip to content

R-alpha: RData in batch

4 messages · Philippe Lambert, Friedrich Leisch, Thomas Lumley +1 more

#
Just a word to mention that I have lost 2 hours yesterday to find out why
R refused to use a function from a package calling C-code.
R invariably answered that the C code was not in the load table (something
like this). I have tried everything (or nearly) to solve my problem
knowing that this same package used to work on my computer at the
university.
Finally, I found out that running the same instructions as root work fine.
The explanation for my computer sudden good will is not that I was root,
but that I ran R in a different directory ... without .RData!!
(and I don't care about .RData when I use R in batch mode!!).

Thus, 
would it be possible to have R not creating .RData file by default in
batch mode?

A second potential problem: when I build packages including personal
functions, I use to test my functions interactively by typing
library(mypackage) after modification of my code in an editor.
The problem is that repeating the library load does not erase the old
version. Do I do something wrong?


Philippe


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
PL> Just a word to mention that I have lost 2 hours yesterday to find out=
 why
PL> R refused to use a function from a package calling C-code.
PL> R invariably answered that the C code was not in the load table (some=
thing
PL> like this). I have tried everything (or nearly) to solve my problem
PL> knowing that this same package used to work on my computer at the
PL> university.
PL> Finally, I found out that running the same instructions as root work =
fine.
PL> The explanation for my computer sudden good will is not that I was ro=
ot,
PL> but that I ran R in a different directory ... without .RData!!
PL> (and I don't care about .RData when I use R in batch mode!!).

There was a bug in dynamic loading by libraries ... the load-table was
written to the .RData file, so R didn't reload any dynamic code after
starting R a second time in a directory upon the library(...) command.
This bug is already fixed in the current sources (which are not
publicly available yet but should be out soon).


PL> Thus,=20
PL> would it be possible to have R not creating .RData file by default in
PL> batch mode?

Why don't you simply rename or delete the .Rdata file before you start
the batch simulation?


PL> A second potential problem: when I build packages including personal
PL> functions, I use to test my functions interactively by typing
PL> library(mypackage) after modification of my code in an editor.
PL> The problem is that repeating the library load does not erase the old
PL> version. Do I do something wrong?

Well, the idea of the library command is to be ``smart'' when loading
code, i.e., library first looks if the package has already been loaded
and only loads the code when this is not already loaded. This way the
overhead of loading the same stuff over and over again can be avoided.

Use source() if you want to override this.


Best,
Fritz

--=20
-------------------------------------------------------------------
                        Friedrich  Leisch                            =20
Institut f=FCr Statistik                      Tel: (+43 1) 58801 4541
Technische Universit=E4t Wien                 Fax: (+43 1)  504 14 98
Wiedner Hauptstra=DFe 8-10/1071      Friedrich.Leisch@ci.tuwien.ac.at
A-1040 Wien, Austria             http://www.ci.tuwien.ac.at/~leisch
     PGP public key http://www.ci.tuwien.ac.at/~leisch/pgp.key
-------------------------------------------------------------------

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
On Thu, 27 Nov 1997, Philippe Lambert wrote:

            
This is a known and probably fixed bug.  The list of currently loaded
dynamic libraries is stored in .Dyn.libs, which is (incorrectly) saved in
.Rdata.  It should just be discarded.  A temporary fix is to add 
	.Dyn.libs<-NULL
to your start-up file.
No. library() is only supposed to load a package if it hasn't already been
loaded.  This is a feature.  You can unload the package with detach() and
then reload with library().  I don't know if compiled code can be unloaded
and reloaded in the current version, though I think it is at least
planned.

	-thomas

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Philippe Lambert writes:
 > Thus, 
 > would it be possible to have R not creating .RData file by default in
 > batch mode?

Hmmm.  Actually I was on your side, but there were a number of
requests to do it the other way.

So let me play Solomon ...

I think that I will introduce two new options to be used when invoking
R.

	R -save
	R -nosave

The default behavior in batch mode will be to refuse to run unless one
of these options is specified.

Multiple versions of these options will be allowed on the command
line, and it is the last (rightmost) one which determines what
happens.

In the front-end shell-script there is a line which reads

	exec $DEBUGGER $RHOME/bin/R.binary $*

and I will change this to

	exec $DEBUGGER $RHOME/bin/R.binary $BATCHSAVE $*

and give the person installing R the option of setting a value for
BATCHSAVE in the config.site script (or when we go gnu --with-save
or --with-nosave).

This way there can be a site-wide selection of the default behavior
which individual users can override.

Sound ok?
	Ross

(I think that Thomas L pointed out that the real bug that bit you has
been fixed too).
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._