How do I change the default directory that file.choose() (Windows-10) uses? D.P. Weygand [[alternative HTML version deleted]]
On 3/3/20 7:29 AM, Dennis Weygand wrote:> How do I change the default directory that file.choose() (Windows-10) uses??setwd -- David> D.P. Weygand > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Hello, You must set the directory manually. old_dir <- getwd() setwd('path/new/dir') file.choose() #other stuff, if necessary end with setwd(old_dir) Hope this helps, Rui Barradas ?s 15:29 de 03/03/20, Dennis Weygand escreveu:> How do I change the default directory that file.choose() (Windows-10) uses? > D.P. Weygand > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
That's what I was about to answer but tried first and it did not work. Now I tried more and noticed an unexpected behavior: getwd() [1] "C:/Users/.../Documents" file.choose() ## opens in "C:/Users/.../Documents" as expected setwd("D:/") getwd() [1] "D:/" file.choose() ## unexpectedly, opens in "C:/Users/.../Documents" setwd("D:/Data") getwd() [1] "D:/Data" file.choose() ## opens in "D:/Data" as expected Is that normal behavior? Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567 Neuwied, Germany +49 (0) 2631 9772-243 https://www.researchgate.net/profile/Ivan_Calandra On 03/03/2020 16:36, David Winsemius wrote:> > On 3/3/20 7:29 AM, Dennis Weygand wrote: >> How do I change the default directory that file.choose() (Windows-10) >> uses? > > > ?setwd > >