[R] unix

Roger Bivand rsb at reclus.nhh.no
Mon Nov 6 17:17:14 CET 2000


On Mon, 6 Nov 2000, Houix Olivier wrote:

> Yes, you can use this:
> 
> system("date > date.txt")
> 
> Meriema Belaidouni wrote:
> > 
> > hello
> > Is it possible to execute Unix command from R prompt?
> > for example
> > ls
> > cd ..
> > 
> 

Both yes and no - I don't think you can change the working directory,
because system() runs a shell process to termination:

> system("pwd")
/home/rsb
> system("cd tmp")
> system("pwd")
/home/rsb
> system("cd tmp; pwd")
/home/rsb/tmp
> system("pwd")
/home/rsb

Is there a way to do this too?

Roger

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand at nhh.no
and: Department of Geography and Regional Development, University of
Gdansk, al. Mar. J. Pilsudskiego 46, PL-81 378 Gdynia, Poland.

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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