oldmansaur oldmansaur - 5 months ago 35
R Question

File.choose for multiple files R

I have a short script that takes a list of csv files and does stuff to them.
The problem I am having is that the file names have to be written into the beginning of the file(filenames=c("file1","file2",...)).

I did find file.choose to get the user to choose a file, but I need a list of files.

Is there a way for the user to choose multiple files?


One option is to install the tcltk library and use tk_choose.files

flist <- tk_choose.files()

## Note: to choose multiple files that are not adjacent in the dialog,
##       you may have to hold down the "control" key or some other key.

There are a number of options for this and it will pop up an x-windows dialog box (you have to have x-windows installed, which would be something like XQuartz on Mac OS X).


Note, this is not quite the same question as this post but the answer is pretty much the same.