I have a batch file to run R commands in a text file and an output file that I 
use. 
 
"C:\Program Files\R\R-2.13.2\bin\x64\R.exe" CMD BATCH    
"C:\Users\Frank\Documents\R\Scripts\TLT_2012.txt" 
"C:\Users\Frank\Documents\R\Scripts\TLT_2012.out"
PAUSE 
 
I worked in an environment that you had to fully specify a path, hence

 "C:\Program Files\R\R-2.13.2\bin\x64\R.exe"
 
which I continue as a personal "best practices."
 
TLT_2012.txt starts with
 
colors <- c("red", "blue", "darkgreen", "gold", "black")
labels <- c("8/11/2011","11/3/2011", "2/28/2012", "5/9/2012")
pdf("C:\\Users\\Frank\\Documents\\R\\Scripts\\TLT_2012.pdf")
.
.
.
 
TLT_2012.out contains the R output and in particular the errors and warnings. I 
always consult the .out file first since I usually have errors :).
 
Best,
 
Frank
Chicago, IL 
 

> Date: Fri, 10 Aug 2012 13:59:34 -0700
> From: sx...@mtlakes.org
> To: r-help@r-project.org
> Subject: [R] Batch Mode for Windows
> 
> Hi, I have researched batch mode for windows and could not find anything that
> worked.
> I know the code should be
> 
> $ R CMD BATCH inputfile.R outputfile.Rout
> or
> R <inputfile.R > outputfile.Rout
> 
> I tried these without success. I need detailed, step by step instructions on
> how to do this. I have tried typing C:\R\bin\x64\Rgui.exe before it, but
> this just opens R.
> 
> When I tried to do this, it said that $, R, etc. are not recognizable
> commands. In other instances it said that the arguments R, CMD, and BATCH
> were ignored. What specifically should I do to make this work? I thought I
> was supposed to change the directory to the folder where my input file was
> stored, but this did not work either. 
> 
> 
> 
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/Batch-Mode-for-Windows-tp4639977.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help@r-project.org mailing list
> 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.
                                          
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
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