[R] shell()/system() question
    Prof Brian Ripley 
    ripley at stats.ox.ac.uk
       
    Wed Nov 28 22:16:13 CET 2001
    
    
  
On Wed, 28 Nov 2001, Prasad, Rajiv wrote:
>
> > -----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.
So the problem is your application, not R.  That's what getwd() and
setwd() are for!
-- 
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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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