[R] problem with "choose.files" command & interactive functions

Shay O'Farrell S.Ofarrell at exeter.ac.uk
Thu Mar 26 14:09:17 CET 2009

Hi all,

I’m new to R, and I’m having a small but annoying problem with the 
choose.files command, using version 2.8.1 in Windows XP. I am holding my 
data text files in C:\\Data\\, and I’m writing a short script that first 
resets the default directory to this directory, then allows me to 
interactively select which text file to import and attach, using the 
Windows widget. Here is my script:


If I copy and paste the script into R Editor (or directly into RGui) and 
run it, it works perfectly. However, if have imported the script using 
the Open Script button in RGui, then I have a glitch... when I run the 
script, the widget looks in the last folder that I opened interactively 
(i.e., the folder from which I imported my script file) instead of 
looking in the new working directory. BUT... if I run line 3 again 
straight after, it works perfectly the second time. What am I doing 
wrong? Any help would be appreciated.



More information about the R-help mailing list