[R] How to direct R to read commands from a text file

Gregory Coats gregcoats at me.com
Sat Oct 31 04:07:25 CET 2015


All of the R commands that I want to issue are in a text file that concludes with the R command quit (save = “yes”), and is called R_commands.txt. I can start R, and then manually issue
source (“R_commands.txt”).
But I would prefer to issue, from the bash command line, a one line command, directing R to start, execute all of the R commands in R_commands.txt, and then quit. How do I do that?
Greg Coats


More information about the R-help mailing list