當我更改工作目錄(例如,從dir1到dir2),然後嘗試使用choose.files()時,第一次選擇.files()運行它將轉到dir1。如果我第二次取消並運行choose.files(),則它會在dir2中打開。我如何獲得choose.files()在最新的工作目錄中打開?爲什麼不在當前工作目錄中打開choose.files()?
(我遇到與file.choose一個不同的問題(),所以我不能夠使用該功能作爲替代)
下面是一個例子:
getwd() # say this is dir1
setwd(choose.dir()) # here I change the wd to dir2
getwd() # currently set to dir2
choose.files() # this opens in dir1
choose.files() # this time it opens in dir2
我想能夠使用此進程從當前工作目錄中選擇一個文件。欣賞任何想法。謝謝!
對於linux/mac上的任何人請注意,'choose.files()'是一個僅限Windows的函數。 – Dason
文檔中「choose.files」的描述:使用Windows文件對話框以交互方式選擇零個或多個文件的列表。所以@Dason是對的。它只適用於windows。 –