[R] Re: pausing a program

Tamas Papp tpapp at axelero.hu
Thu Apr 22 16:48:57 CEST 2004


On Thu, Apr 22, 2004 at 08:52:23AM -0500, Jason.L.Higbee at stls.frb.org wrote:

> R:
> 
> I have a program that runs a For loop for days and I need to (if possible) 
> pause the program.  Any ideas on how to do that?  If I use stop, how 
> certain can I be that all the statements executed in the previous 
> iteration of the for loop?

What I usually do is start the program from the shell prompt (you need
Unix for that) command line (R <problem.r >problem.log) and use Ctrl-Z
to pause it, and fg (shell command to restart it).

I think that you might be able to achieve the same effect using the
unix command kill, look at the man page (you need kill -STOP pid and
kill -CONT pid).

If you are referring to kill -STOP in your message (the stop() in R
does something completely different), I don't see what you want.  Have
the program print something [eg print(paste("completed iteration #", i))]
at the end of each loop, and use

$ tail problem.log

to check that.  BTW, how could any of the statements in the loop body
NOT execute? I don't get it.  A loop executes all of its body in each
iteration, so all the statements in the previous iteration were
executed by definition...

Best,

Tamas

-- 
Tamás K. Papp
E-mail: tpapp at axelero.hu
Please try to send only (latin-2) plain text, not HTML or other garbage.




More information about the R-help mailing list