因此,我所做的是做我的浏览按钮,以便当我点击他们直接把用户带到目录,我希望他们保存他们的文件或寻找他们的文件。
例如
setwd("C:\\Users\\Eric\\Desktop\\Program\\graphs") #set directory
file.choose()但是,在前面的脚本中,我已经将工作目录设置为
setwd("C:\\Users\\Eric\\Desktop\\Proram") #set directory所以当我运行第一个例子时,它把我带到了目录程序,而不是图表。但是,当我第二次运行file.choose()时,它将我带到图形目录,为什么会发生这种情况?知道怎么解决这个问题吗?
发布于 2013-10-26 13:14:28
下面是解决您的问题的快速而肮脏的解决方案:
dirPath <- "C:\\Users\\Eric\\Desktop\\Program\\graphs"
setwd(dirPath)
# Tell R to sleep until the current directory matches the expected directory
while(getwd() != normalizePath(dirPath)) {
Sys.sleep(0.02)
}
file.choose()https://stackoverflow.com/questions/19604944
复制相似问题