Skip to content
Back to formatted view

Raw Message

Message-ID: <14854.56147.924115.748451@galadriel.ci.tuwien.ac.at>
Date: 2000-11-06T16:24:51Z
From: Friedrich Leisch
Subject: unix
In-Reply-To: <Pine.LNX.4.21.0011061713030.23606-100000@reclus.nhh.no>

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