RE: [R] Rterm

About this list Date view Thread view Subject view Author view Attachment view

From: Johannes SCHNITZLER (schnitzlerj@lyon.who.int)
Date: Sat 08 May 2004 - 00:51:51 EST


Message-id: <AD1C47A0C9C12C46987E2D31EE1E63B404030E@lps001.lyon.who.int>

Thank you very much for the fast answers,

It work's very well

Johannes

-----Original Message-----
From: Prof Brian Ripley [mailto:ripley@stats.ox.ac.uk]
Sent: 07 May 2004 16:16
To: Jason Turner
Cc: Johannes SCHNITZLER; r-help@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 R
can
> 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 R
run.
> 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@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

______________________________________________ R-help@stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Mon 31 May 2004 - 23:05:08 EST