[R] Batch files in R

Martin Maechler maechler at stat.math.ethz.ch
Thu Jul 3 11:18:22 CEST 2003


>>>>> "Adaikalavan" == Adaikalavan Ramasamy <gisar at nus.edu.sg>
>>>>>     on Thu, 3 Jul 2003 11:32:21 +0800 writes:

    Adaikalavan> You can use save(object1, file="lalala.1"),
    Adaikalavan> save(object1, file="lalala.2"), ... and the use
    Adaikalavan> load() to restore the object1 and object2. Or
    Adaikalavan> if you have many objects in a simulation to
    Adaikalavan> save, you can save all objects using
    Adaikalavan> save.image("sim1.result.R").

yes, but use more sensible filename endings, definitely not '.R'.
*The* recommended ending for such files really is '.rda',
see also help(data).

    Adaikalavan> Another option is to use write.table or zz <-
    Adaikalavan> file("lalal1.txt"); cat( ... , file=zz) etc if
    Adaikalavan> you want a human-readable form of your output.

    Adaikalavan> It would be a good idea to use the
    Adaikalavan> compress=TRUE option in save() and R --no-save.

definitely two good ideas.
I think the only reason  compress=TRUE  hasn't becomde the
default behavior is the fact that it wasn't available on all
platforms (at some time point at least), 
see  capabilities("libz")  and  ?capabilities

Martin Maechler <maechler at stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO C16	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><




More information about the R-help mailing list