[R] Batch mode on windows

John Fox jfox at mcmaster.ca
Thu Oct 17 04:45:16 CEST 2002


Dear chenwj,

At 08:35 AM 10/17/2002 +1000, king at tolstoy.newcastle.edu.au wrote:

>I'm completely new in R, and here are my questions (under windows):
>
>1.  i want to run my four R files (pl1.r -- pl4.r) in batch mode.  i'd
>like to write a batch file using Rterm.exe, since i dont get perl
>installed on my computer.  My experimental batch file (*.bat) didnt work,
>which contains the following lines.  however it works well when i pasted
>each single line to run in the command prompt (eg. cmd).  i wonder what's
>wrong with my batch file.
>
>D:\R\bin\Rterm.exe --vanilla <d:\work\pl1.r> pl1.out
>D:\R\bin\Rterm.exe --vanilla <d:\work\pl2.r> pl2.out
>D:\R\bin\Rterm.exe --vanilla <d:\work\pl3.r> pl3.out
>D:\R\bin\Rterm.exe --vanilla <d:\work\pl4.r> pl4.out

It's a little hard to tell exactly what the problem is. If each of the 
command files pl1.r, etc. works individually, this looks to me like it 
should work. It might help to know what the command files contain and what 
was the nature of the error. Your experimental DOS batch file must have had 
a specific name -- I assume something.bat. You are trying to run the DOS 
batch file at the DOS command prompt, aren't you -- not from the R console?

>
>2. If one of my above R files contains a function from a outside package
>(eg. quantreg), how to load it in command prompt, or how to get the
>package loading process involved in my batch file?

You need to attach packages in the command file just as you would if you 
were working interactively -- e.g., by including the command library(quantreg).

I hope that this helps,
  John

-----------------------------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
email: jfox at mcmaster.ca
phone: 905-525-9140x23604
web: www.socsci.mcmaster.ca/jfox
-----------------------------------------------------

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list