[R] executable R scripts

John Zedlewski johnz at vmware.com
Mon Jun 9 02:35:14 CEST 2003


Hi, I'm a newbie trying to make an R program executable on UNIX, just like one 
would write an executable perl script by putting "#!/usr/bin/perl" in the 
first line, and so on.

It seems, though, that this would only work if I use the "BATCH" command to 
tell R to execute the program in its first argument. This would have the 
unfortunately side-effect of dumping all output to a file rather than stdout.

Additionally, I'd want to see only the results of "print" statements on 
stdout, not all off R's output, just as when you source a script with 
echo=FALSE.

This seems like it would be a pretty common problem, but I haven't found any 
explanations in the docs. Does somebody have a sample script that I could 
look at for advice? Or should I just bite the bullet and write a wrapper 
shell script?

Thanks!
--JRZ




More information about the R-help mailing list