Batch Mode for Windows

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Batch Mode for Windows

sharx
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.
Reply | Threaded
Open this post in threaded view
|

Re: Batch Mode for Windows

Duncan Mackay-2
Hi

Here is a script I have used sometime ago to do a job i cannot
remember what Windows OS it was. the first line is the general form

  # R CMD BATCH [options] infile [outfile]
  c:\rw\bin\R CMD BATCH --no-restore --no-save
D:/Feh/R/FEH_Index_in.R D:/Feh/R/FEH_Batch.txt

  the FEH_Batch.txt is the log file for the batch

HTH

Duncan

Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home: [hidden email]


At 06:59 11/08/2012, you wrote:

>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.
>
>______________________________________________
>[hidden email] 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.

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: Batch Mode for Windows

Uwe Ligges-3
In reply to this post by sharx


On 10.08.2012 22:59, sharx wrote:
> 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

Almost right, see below.


> 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 $

$ indicates you shoudl thpy in the OS shell. Do not repeat that one when
typing commands.

> , R, etc. are not recognizable

In that case, you have not added the directory where R.exe lives to the
PATH environment variable.

Uwe Ligges


> 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.
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: Batch Mode for Windows

FJ M
In reply to this post by sharx

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: [hidden email]
> To: [hidden email]
> 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.
>
> ______________________________________________
> [hidden email] 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]]

______________________________________________
[hidden email] 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.