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.s...@imail.org
801.408.8111


> -----Original Message-----
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of joseph.g.bo...@gsk.com
> Sent: Tuesday, February 03, 2009 3:10 PM
> To: Gabor Grothendieck
> Cc: r-help@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" <ggrothendi...@gmail.com>
> 02-Feb-2009 18:53
> 
> To
> joseph.g.bo...@gsk.com
> cc
> r-help@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.bo...@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@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.

______________________________________________
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