[R] slow R start up

Stuart Macgregor stuart.macgregor at qimr.edu.au
Mon Nov 7 08:04:12 CET 2005


Hi,
   I want to use R within a unix shell script where I repeatedly open
and close R (doing some computation within R whilst it is open). i.e.
something like

#!/bin/sh
R --vanilla << EOF
# some R commands
EOF
# some unix commands
R --vanilla << EOF
# some R commands
EOF
# some unix commands
...etc

the problem is that since I open and close R many times, the shell
script takes a long time to run (R takes ~1 second to start up, even on
a fast machine; I've tried various linux installations and versions of R
from 1.7 to 2.2). Is there some way of making R start up faster? I've
tried altering the memory start options but this makes little
difference.
Note I have various other programs called from the shell script and
don't want to do everything from "within" R. 
One possible solution may be to send the relevant commands to an already
running copy of R but I've yet to figure out how to achieve this.

Any suggestions gratefully received.

Stuart.




More information about the R-help mailing list