[R] running R command in the background

Andrew Young youngas7 at yahoo.com
Fri Jun 4 21:11:39 CEST 2004


You could try looking at the library "fork".  However,
this generally sounds like a bad idea and if you do
this, you're kind of asking for trouble with threading
issues, as R is not thread-safe.

I'm not sure if fork works on all platforms, since I
believe it works by running a unix shell command. But
it's worth a shot.

Best regards,
-Andrew


--- Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
> This cannot presently be done, as the R internals do
> not multitask.  I am 
> not sure what you would want to happen if the
> background and foreground 
> commands both tried to write a new version of object
> `foo', BTW.
> 
> Allowing multiple execution threads and setReader()
> as described in the
> Green Book is a design goal and has been since 2001
> at least, so don't
> expect it soon.  It is hard (lots of the code used,
> e.g. LINPACK, is not
> reentrant and so needs to be semaphored) and if
> achieved will need
> vigilance to keep working.
> 
> On Fri, 4 Jun 2004, Bickel, David wrote:
> 
> > Is there a way to call an R function to work in
> the background within
> > the same R session? What I have in mind is the
> equivalent of adding '&'
> > at the end of a UNIX command, so that R can
> process an intensive command
> > while I execute other R commands. I want to do
> this in the same R
> > session, rather than with multiple calls to R, so
> that all my modified
> > objects will stay in the same workspace.
> > 
> > I would appreciate any help with this.
> 
> -- 
> Brian D. Ripley,                 
> ripley at stats.ox.ac.uk
> Professor of Applied Statistics, 
> http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865
> 272861 (self)
> 1 South Parks Road,                     +44 1865
> 272866 (PA)
> Oxford OX1 3TG, UK                Fax:  +44 1865
> 272595
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
>
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html




More information about the R-help mailing list