[R] unix

Friedrich Leisch Friedrich.Leisch at ci.tuwien.ac.at
Mon Nov 6 17:24:51 CET 2000


>>>>> On Mon, 6 Nov 2000 17:17:14 +0100 (CET),
>>>>> Roger Bivand (RB) wrote:


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

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

RB> Is there a way to do this too?


Sure, using setwd():

> system("pwd")
/home/Leisch/bin
> setwd("/tmp")
NULL
> system("pwd")
/tmp

best,
.f
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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