Dear all, Two questions regarding rterm First: C:\Program Files\R\rw1081\bin\rterm.exe --vanilla <test.r --args "Arg1" "Arg2" worked for me so far with r Version 1081, to start a R script with the given arguments. With R1090 C:\Program Files\R\rw1090\bin\rterm.exe --vanilla <test.r --args "Arg1" "Arg2" There is the error message: Rterm.exe is not a valid Win32 application I tried on Windows 2000 and XP I couldn't find out what to change. Second: I would like to set the working directory as well, in the same command, when calling an r script with rterm.exe from the command line. Is there a way to do this? Can somebody help me with these issues? Thank you Johannes [[alternative HTML version deleted]]
> With R1090 > > C:\Program Files\R\rw1090\bin\rterm.exe --vanilla <test.r --args "Arg1" > "Arg2" > > There is the error message: Rterm.exe is not a valid Win32 application > > I tried on Windows 2000 and XP > > I couldn't find out what to change.Weird. Did you install in C:\Program Files\R\rw1090\? On my XP machine, it did, and rterm is valid. The above works from a command prompt, provided I wrap the executable path and name in quotes. Failing that, is it a corrupt binary install? Here's the md5 of my (working) R-1.9.0, downloaded from CRAN (NOT the patched version, and not built by me) C:\Program Files\R\rw1090\bin> md5sum.exe Rterm.exe 2565cd848bbd86b964624a0490352da2 *Rterm.exe> I would like to set the working directory as well, in the same command, > when calling an r script with rterm.exe from the command line. > > Is there a way to do this?Inside R: setwd("your/path/here") With the usual warning about using "/" slashes, or "\\" slashes (doubled). I just stick with "/". Cheers Jason
Dear Jason, Thank you very much, the first problem is solved. It was a corrupted file. After downloading a new version rterm works! The second question: I was trying to set the working directory while I'm calling a script with Rterm.exe from the command line. Something like c:\Program Files\R\rw1090\bin\rterm.exe --vanilla "workingdir=c:/data/" <test.r --args "Arg1" "Arg2" Thank's again Johannes -----Original Message----- From: Jason Turner [mailto:jasont at indigoindustrial.co.nz] Sent: 07 May 2004 12:15 To: Johannes SCHNITZLER Cc: r-help at stat.math.ethz.ch Subject: Re: [R] Rterm> With R1090 > > C:\Program Files\R\rw1090\bin\rterm.exe --vanilla <test.r --args"Arg1"> "Arg2" > > There is the error message: Rterm.exe is not a valid Win32 application > > I tried on Windows 2000 and XP > > I couldn't find out what to change.Weird. Did you install in C:\Program Files\R\rw1090\? On my XP machine, it did, and rterm is valid. The above works from a command prompt, provided I wrap the executable path and name in quotes. Failing that, is it a corrupt binary install? Here's the md5 of my (working) R-1.9.0, downloaded from CRAN (NOT the patched version, and not built by me) C:\Program Files\R\rw1090\bin> md5sum.exe Rterm.exe 2565cd848bbd86b964624a0490352da2 *Rterm.exe> I would like to set the working directory as well, in the samecommand,> when calling an r script with rterm.exe from the command line. > > Is there a way to do this?Inside R: setwd("your/path/here") With the usual warning about using "/" slashes, or "\\" slashes (doubled). I just stick with "/". Cheers Jason
Thank you very much for the fast answers, It work's very well Johannes -----Original Message----- From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk] Sent: 07 May 2004 16:16 To: Jason Turner Cc: Johannes SCHNITZLER; r-help at stat.math.ethz.ch Subject: Re: [R] Rterm On Sat, 8 May 2004, Jason Turner wrote:> Johannes SCHNITZLER wrote: > > The second question: > > I was trying to set the working directory while I'm calling a script > > with Rterm.exe from the command line. > > Something like > > c:\Program Files\R\rw1090\bin\rterm.exe --vanilla"workingdir=c:/data/"> > <test.r --args "Arg1" "Arg2" > > Not sure - if you could pass the working directory as an arg, then Rcan> handle it from there - use the setwd() command. What I usually do on > Un*x-like systems is to cd to the directory first, then start the Rrun.> Something like.... > > cd "my favorite dir" > R --vanilla ... > > Since you're already specifying the absolute path for Rterm, the above> should work...That's the only way. The `working directory' is the directory from which you launch an application (although you can fix that by a shortcut). R looks in the working directory for several things, e.g. a .Rprofile file, before it ever runs any R code like setwd. If that is not a problem you can use something like (from a decent shell) (echo "setwd(somewhere"); cat test.r) | Rterm.exe --args "Arg1" to make the first R code run change directories. Or you can have at the top of test.r setwd(Sys.getenv("WD")) and use Rterm.exe WD="c:/data" < test.r --args "Arg1" "Arg2" -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595