[R] executing R batch files
Greg.Snow at imail.org
Wed Feb 4 20:01:42 CET 2009
Let me guess, you are using MSwindows and using notpad as the editor.
Notepad has this annoying "feature" that if you save a file as a text file then it automatically adds '.txt' to the end of the file name. So when you saved as a text file it actually named the file "Rbatch.bat.txt" and the computer could not find the file "Rbatch.bat" since that file does not exist (and even if it found the file, it is not a .bat file so it would not run it). Windows by default also has the additional feature that it likes to hide these types of details from you for your own protection.
Windows assumes that the computer is smarter than the user and if you are doing something that was not anticipated by MS then you are clearly doing something wrong and should be prevented.
Apparently you are too intelligent to be using MSwindows and notepad (as could be said for anyone smart enough to use R). Unfortunately some of us are in situations where the person who decides which OS we will use is either not too intelligent to use windows, or has not realized yet that they are.
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
greg.snow at imail.org
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of joseph.g.boyer at gsk.com
> Sent: Tuesday, February 03, 2009 3:10 PM
> To: Gabor Grothendieck
> Cc: r-help at r-project.org
> Subject: Re: [R] executing R batch files
> Thank you, I appreciate your reply.
> I have managed to get Shell("c:\TEMP\Rbatch.bat") to work.
> What solved the problem was saving the Rbatch.bat file as type "All
> as opposed to as a text file.
> Why that worked, I have no idea.
> Joe Boyer
> Statistical Sciences
> Renaissance Bldg 510, 3233-D
> Mail Stop RN0320
> cell: (610) 209-8531
> "Gabor Grothendieck" <ggrothendieck at gmail.com>
> 02-Feb-2009 18:53
> joseph.g.boyer at gsk.com
> r-help at r-project.org
> Re: [R] executing R batch files
> Without the actual VBA commands you are using we
> can't be sure but if you are using Shell then it requires an exe,
> not a bat file. Try
> cmd.exe /c RBatch.bat
> so that it has an exe file to execute.
> On Mon, Feb 2, 2009 at 6:42 PM, <joseph.g.boyer at gsk.com> wrote:
> > The following command, issued from the DOS command prompt (running
> > XP), produces the intended result of a .csv file created by
> > ?c:\program files\R\R-2.8.0\bin\Rterm.exe? --save <
> > However, when I create a file called Rbatch.bat that contains exactly
> > line above, and try to execute it (by double clicking or via the
> > command
> > in an Excel macro), nothing happens.
> > Does anyone have an explanation, or any suggestions as to how to run
> > program from within an Excel macro? (PS: I know about RExcel, can't
> > get it to install
> > correctly.)
> > Much appreciated.
> > Joe Boyer
> > Statistical Sciences
> > Renaissance Bldg 510, 3233-D
> > Mail Stop RN0320
> > 8-275-3661
> > cell: (610) 209-8531
> > [[alternative HTML version deleted]]
> > ______________________________________________
> > R-help at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> > and provide commented, minimal, self-contained, reproducible code.
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help