[R-SIG-Mac] R --vanilla --slave

Simon Urbanek Simon.Urbanek at math.uni-augsburg.de
Mon May 10 19:03:41 CEST 2004


On May 10, 2004, at 6:28 PM, Andrew Beckerman wrote:

> I am trying to use the following syntax (so I can submit R scripts to 
> an X-grid cluster if anyone is interested):
>
> dyn094076:~ apb$ R --vanilla --slave <test.R> test.txt
>
> to run the following script
>
> #test.R
> write(rnorm(4)," ")
> q()
>
> as suggested in 
> http://finzi.psych.upenn.edu/R/Rhelp02a/archive/20955.html
>
> The script is a BBedit file called test.R, is in my home and fails by 
> producing a blank text file.
> I have also tried including the file="test.txt" addition in the 
> write() function, and leaving out the # line, which results with the R 
> startup verbiage being printed to the file, but no data.

Well, by definition none of the things you described should actually 
work:
using " " in write just created a file with the name " " which is just 
a space - yes, this is legal :). You should have such file in your home 
now. I doubt it's what you wanted.
Using write(..., "test.txt") can't succeed either, because in the shell 
you use redirect of the console to test.txt, hence the file is already 
open for writing for stdout pipe, so you can't open it once more for 
writing in the "write" command. Again, I doubt it's what you intended.

If you insist on using the parameters you mentioned and "write", then 
you can do either :

R --vanilla --slave < test.R > test.txt
with: write(rnorm(4), "")

or alternate approach (but with the same result):

R --vanilla --slave < test.R
with: write(rnorm(4), "test.txt")

> Is there an OS X method for this? Am I missing something (probably)?

Beside X-grid there's a really nice package by Luke Tierney "snow" that 
is far more flexible and allows really nice parallel computing, not 
just parallel shell processes. We use it with PVM3 on our Apple 
cluster. Everything has its pros and cons - it mainly depends on what 
you actually want to do ...

Cheers,
Simon

---
Simon Urbanek
Department of computer oriented statistics and data analysis
University of Augsburg
Universitätsstr. 14
86135 Augsburg
Germany

Tel: +49-821-598-2236
Fax: +49-821-598-2200

Simon.Urbanek at Math.Uni-Augsburg.de
http://simon.urbanek.info



More information about the R-SIG-Mac mailing list