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

Boris Steipe boris.steipe at utoronto.ca
Sat Oct 31 05:46:45 CET 2015


I should think this thread contains all you need:
   http://stackoverflow.com/questions/18306362/run-r-script-from-command-line


B.


On Oct 30, 2015, at 11:07 PM, Gregory Coats <gregcoats at me.com> wrote:

> 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
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list