R 为什么不选择在当前工作目录中打开.files()?
当我更改工作目录时,例如从dir1更改为dir2,然后尝试使用choose.files,第一次运行choose.files时,它将转到dir1。如果我取消并再次运行choose.files,它将在dir2中打开。如何在最新的工作目录中打开choose.files 我在file.choose中遇到了另一个问题,因此我无法使用该函数作为替换 下面是一个例子:R 为什么不选择在当前工作目录中打开.files()?,r,filechooser,R,Filechooser,当我更改工作目录时,例如从dir1更改为dir2,然后尝试使用choose.files,第一次运行choose.files时,它将转到dir1。如果我取消并再次运行choose.files,它将在dir2中打开。如何在最新的工作目录中打开choose.files 我在file.choose中遇到了另一个问题,因此我无法使用该函数作为替换 下面是一个例子: getwd() # say this is dir1 setwd(choose.dir()) # here
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
我希望能够使用此进程从当前工作目录中选择一个文件。谢谢你的建议。谢谢 尝试将此掩码添加到默认参数:
choose.files(default=paste0(getwd(), "/*.*"))
从?的帮助中选择.files:
如果要显示特定目录中的文件,请给出
默认参数中的完全限定文件掩码,例如c:\*.*
对于linux/mac上的任何人,请注意choose.files是仅限Windows的功能。文档中的choose.files说明:使用Windows文件对话框以交互方式选择零个或多个文件的列表。所以@Dason是对的。它仅适用于windows。当我键入?choose.files时,它不会返回“choose.files”的文档。我在用Ubuntu。choose.files仅在windows上工作。你使用的是什么操作系统Narendra?@我使用的是Ubuntu。我刚刚在线查看了文档。它说choose.files只在Windows上工作。