OS-independent way to select directory interactively in R

后端 未结 5 929
Happy的楠姐
Happy的楠姐 2021-02-12 10:54

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

5条回答
  •  被撕碎了的回忆
    2021-02-12 11:45

    for some use cases a little trick might be to use dirname() around 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

提交回复
热议问题