[R] run R under unix

Jason Turner jasont at indigoindustrial.co.nz
Thu Oct 9 07:52:36 CEST 2003


Zhen Pang wrote:
...
> I now want to run the code under unix. However, I do not know how to run 
> this code in txt file under unix. I just log in to the unix and enter 
> the R, what should I do next?
> 
> One more question is: if I log off my computer when R is running under 
> unix (i.e., disconnect my computer from server), will I get the result 
> when I log in my computer next time?
...

You'll lose it if you run R in the normal, interactive way.  Running it 
in the background will allow you to log out and still have it running, but!

1) If you're not the only person using this machine, you learn the 
command "nice" before you begin.
2) I'm not certain you'll be able to produce jpeg or png graphics when 
backgrounded; your backgrounded task needs access to the windowing 
system for graphics rendering, and local security policy might prohibit 
this.
3) Save early, save often.  You probably already know that, but it bears 
repeating.

Here are some suggested steps to run your simulation in background mode. 
  Unfortunately, the exact commands will depend on which version of Unix 
you're using, and what command shells are available.  Consult your local 
expert.

1) transfer the text file of commands to the unix machine.  FTP, using 
ASCII mode is safest.
2) log onto the Unix machine.
3) run sh, ksh, or bash.  (the syntax for what follows is different for 
the C shell, and I don't know it).
4) using a stripped-down version of your script which will complete in a 
short time (say, a minute or two), just to check that things work, type

nohup nice 15 R < my.small.script >my.output 2>&1 &

(again, learn what "nice" means before you use it.  This may not be 
suitable, and it's impossible for me to tell from here if it is).

I know that's not the full answer, but only someone who knows the local 
setup can give you that answer.

Cheers

Jason
-- 
Indigo Industrial Controls Ltd.
http://www.indigoindustrial.co.nz
64-21-343-545
jasont at indigoindustrial.co.nz




More information about the R-help mailing list