An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090202/b4623557/attachment-0001.pl>
executing R batch files
4 messages · joseph.g.boyer at gsk.com, Gabor Grothendieck, Greg Snow
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 Windows
XP), produces the intended result of a .csv file created by program.R:
?c:\program files\R\R-2.8.0\bin\Rterm.exe? --save < "c:\TEMP\program.R"
However, when I create a file called Rbatch.bat that contains exactly the
line above, and try to execute it (by double clicking or via the Shell
command
in an Excel macro), nothing happens.
Does anyone have an explanation, or any suggestions as to how to run an R
program from within an Excel macro? (PS: I know about RExcel, can't quite
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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090203/5e1a4d8a/attachment-0001.pl>
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
Intermountain Healthcare
greg.snow at imail.org
801.408.8111
> -----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
> files"
> 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
> 8-275-3661
> cell: (610) 209-8531
>
>
>
> "Gabor Grothendieck" <ggrothendieck at gmail.com>
> 02-Feb-2009 18:53
>
> To
> joseph.g.boyer at gsk.com
> cc
> r-help at r-project.org
> Subject
> 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
> Windows
> > XP), produces the intended result of a .csv file created by
> program.R:
> >
> > ?c:\program files\R\R-2.8.0\bin\Rterm.exe? --save <
> "c:\TEMP\program.R"
> >
> > However, when I create a file called Rbatch.bat that contains exactly
> the
> > line above, and try to execute it (by double clicking or via the
> Shell
> > command
> > in an Excel macro), nothing happens.
> >
> > Does anyone have an explanation, or any suggestions as to how to run
> an
> R
> > program from within an Excel macro? (PS: I know about RExcel, can't
> quite
> > 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
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
>
>
> [[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 http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.