One can run R 'txt', script files thusly: 1. create the txt file (foo.txt) script. 2. at a command prompt type : R --vanilla < foo.txt > foo.results
The file 'foo.results' will now have all the output that you normally would see on the screen. This is actually quite useful in that you can move around freely within foo.results (using some sort of text editor) - unlike results written to a screen. This will only run while you are logged into the machine, however. The best way to run a script without having to be logged in is through a batch processor. Indeed, for jobs running for days - your system administrator will be thrilled that it runs on the batch processor instead of interactively. The method for doing this depends on your particular unix machine configuration, but a common method flow like this: 1. Place the line: R --vanilla < foo.txt > foo.results into a file named foo.batch. No other text should be in the file. Make this file executable via > chmod 755 foo.batch Then at the command line: > at -f foo.batch now or perhaps, > batch -f foo.batch If this does not work, ask your system administrator how to set up a batch process. The advantage of the batch process is 1) you need not be logged in, 2) your job will take a lower priority than interactive jobs. Michaell On Thu, 2003-10-09 at 01:52, Jason Turner wrote: > 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 > [EMAIL PROTECTED] > > ______________________________________________ > [EMAIL PROTECTED] mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help