OS-independent way to select directory interactively in R

后端 未结 5 1476
难免孤独
难免孤独 2021-02-12 11:17

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:35

    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

提交回复
热议问题