[R] shell()/system() question
Prasad, Rajiv
Rajiv.Prasad at pnl.gov
Wed Nov 28 21:28:54 CET 2001
> -----Original Message-----
> From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk]
> Sent: Wednesday, November 28, 2001 12:13 PM
> To: Prasad, Rajiv
> Cc: R-Help (E-mail)
> Subject: Re: [R] shell()/system() question
>
>
> On Wed, 28 Nov 2001, Prasad, Rajiv wrote:
>
> > Hi folks:
> >
> > How do I get shell() or system() to run external programs
> > in a particular
> > directory (different from the current R working directory)?
>
> Give the full path.
Guess I did not specify the problem entirely. Apologies. I'll try again.
The "program" that I am trying to run accesses files stored in the same
directory where it is run, and produces output to stdout, which I am trying
to capture directly into R via shell(). This works well if the current
working directory in R is the same as where the program to be run is
located. If not, the program fails since it cannot access its supporting
data files.
Since my earlier mail, I figured a workaround, using getwd() and setwd() to
temporarily change the R working directory, run the program using shell(),
and reset the R working directory to where it originally was. Works via a
wrapper function.
Just wondering if shell() or system() may be provided with a "wd" argument?
Not a big deal, since the wrapper is easy to write.
Thanks for your quick reply.
Rajiv.
--------
Rajiv Prasad
Postdoctoral Research Associate, Hydrology Group
Pacific Northwest National Laboratory, P.O. Box 999, MSIN K9-33
Richland, WA 99352
Voice: (509) 375-2096 Fax: (509) 372-6089 Email: rajiv.prasad at pnl.gov
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list