[BlindRUG] Input output via batch file question

Godfrey, Jonathan A.J.Godfrey at massey.ac.nz
Wed Mar 16 20:42:52 UTC 2016


Syed,

Yes, Tim's approach is one way to get what you need. It works well and delivers what you are asking for.

There are several others. A more traditional way is to use:
"%InstallPath%\bin\i386\r.exe" CMD BATCH --vanilla -quiet MyScript.R
You'll need to put in the path to your version of R where I have %InstallPath%, but do leave the quote marks alone. The i386 can be changed to the 64 bit folder if needed. The --vanilla ensures the session used to process your script file (MyScript.R) is a clean one, and the --quiet stops the welcome message being printed in the output file. The default output file will be called MyScript.Rout that is the output file is just the input filename with the extension altered. It is just a text file and can be opened in notepad or any other text editor of your choosing.

You can add those switches to the line offered by Tim too by the way.

In version 0.23.1  of the BrailleR package I added a MakeBatch() function to generate the right command line in a batch file for a given filename. I'm close  to rolling the changes in BrailleR out to CRAN. In fact I really ought to get on with that ASAP. The development version is available via GitHub though. Instructions for installing from GitHub can be found on the BrailleR homepage at
http://R-Resources.massey.ac.nz/BrailleR/

Cheers,
Jonathan







From: BlindRUG [mailto:blindrug-bounces at nfbnet.org] On Behalf Of Tim in 't Veld via BlindRUG
Sent: Thursday, 17 March 2016 7:44 a.m.
To: Blind R Users Group
Cc: Tim in 't Veld
Subject: Re: [BlindRUG] Input output via batch file question

Dear Syed ,
Below is the batch file (a single line) I use to save the output of a script "in.r" to file "out.txt". Make sure to adapt the path for the R executable and ensure to run this batch file from the same directory where your "in.r" is located.

"C:\Program Files\R\R-3.2.3\bin\x64\Rterm.exe" --no-save < in.R > out.txt

Mind the quotes and the > sign in the above line, both are essential components.
Hope this helps,
Tim
On 3/16/2016 7:31 PM, Syed Rizvi via BlindRUG wrote:
Hello All,
I am a student at the Louisiana Center for the Blind and am trying to learn how to use R for my career in business information systems.

I am trying to construct a batch file that will take my R script input file, run it, and save the output in a text file.
I have tried using all the other resources but I can't find syntax specific to what I am trying to do. As of right now in my batch file I have the path statement at the top to define my environment variable. Now what I am trying to do is pass my input to RTerm and save the output.
If anyone can guide me in this, I would be extremely appreciative.
Thank you,
Syed Rizvi






_______________________________________________

BlindRUG mailing list

BlindRUG at nfbnet.org<mailto:BlindRUG at nfbnet.org>

http://nfbnet.org/mailman/listinfo/blindrug_nfbnet.org

To unsubscribe, change your list options or get your account info for BlindRUG:

http://nfbnet.org/mailman/options/blindrug_nfbnet.org/tim%40dvlop.nl

The list archive can be viewed at:

http://www.nfbnet.org/pipermail/blindrug_nfbnet.org

More information and useful links about using R as a blind person can be obtained at:

http://R-Resources.massey.ac.nz



Look for help using R commands by reading the accessible e-book "Let's Use R Now" compiled by Jonathan Godfrey at:

http://R-Resources.massey.ac.nz/lurn/front.html

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nfbnet.org/pipermail/blindrug_nfbnet.org/attachments/20160316/7d0d399d/attachment.html>


More information about the BlindRUG mailing list