On Wed, 25 Jul 2018, Bert Gunter wrote:

"Within R one can use source() to run a batch file of R commands, while R
CMD BATCH and Rscript are run from the command line. Is this correct?"

Yes.

Bert,

  Thanks for confirming.

I think your query answers your query: You use Rscript when you want to use
R in the command environment, perhaps as part of an analytical pipeline;
and you source an R file when you want to work within R.

  That's a given. Why would I prefer Rscript over R CMD BATCH, or
vice-versa? I did not see much difference between the two in their help
files.

Regards,

Rich

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to