How can I avoid having my R script printed every time I run it?

Resolution is to run with Rscript, and not with R. Examples elsewhere (e.g. How can I read command line parameters from an R script?), run scripts from the command line with

R --args args1 args2... < foo.R

running with

Rscript foo.R args1 args2 ...

produces only the output, and not the script. It's also a much cleaner way to run scripts.


Not an R user myself, but is this something that might be helpful to you? How can I run an 'R' script without suppressing output?

From the linked question:

specify print.eval parameter set to TRUE if you want to get only the output (and not the commands). If you would need the commands too, you should set echo to TRUE (which implies setting print.eval to TRUE).

For example:

source('myscript.R', print.eval = TRUE)

Tags:

R

R Faq