I would like users to be able to select a directory interactively in R. The solution needs to work on different platforms (at least on Linux, Windows and Mac machines that have
for some use cases a little trick might be to use dirname() around file.choose()
dirname()
file.choose()
dir <- dirname(file.choose())
this will return the directory. It does however require at least one file to be present in the directory