I need to write a small R script for people who never used R before that imports a file and does some things with it. I would like to minimize user input as much as possible
The tcltk package gives you tk_choose.files.
If you want to go beyond file choosers then you can use the package to build user interfaces.
The file.choose
function performs this, eg:
fname <- file.choose()
source(file.choose())
You may also want to look at choose.files
(for multiple files) and choose.dir
(for just selecting a directory path).
It's worth mentioning rChoiceDialogs::rchoose.files
. I'm not completely sold yet, but they advertise it as being completely cross platform and fixing the annoying problem common to choose.files
and tk_choose.files
of popping up behind other windows. See their vignette here.