file.choose() 在 Windows 上打开对话框时没有文件名。

huangapple go评论87阅读模式
英文:

file.choose() opens dialogue without file names on Windows

问题

当我使用 file.choosechoose.files 选择文件时,对话框窗口显示文件夹图标但没有文本。这个问题之前没有出现过。我不久前更新了 RStudio,但不确定是否是原因。我目前使用的是 R 4.1.1 和 RStudio 2023.03.0 Build 386。file.choosebase 中,choose.filesutils 中,因此它们应该都是最新的。即使在没有加载其他包的新 R 进程中,我也看到这种行为,所以我知道我是在 base R 中调用这些函数。

英文:

When I use file.choose or choose.files to select a file, the dialogue window shows folder icons but no text.

file.choose() 在 Windows 上打开对话框时没有文件名。

This problem did not occur previously. I did update RStudio not too long ago, but I am not sure if that is the cause. I am currently using R 4.1.1 and RStudio 2023.03.0 Build 386.

file.choose is in base and choose.files is in utils, so they should both be up to date. I see this behavior even in a new R process with no additional packages loaded, so I know that I am calling the functions in base R.

答案1

得分: 1

按照今天的情况,没有改变任何东西,我也有这个视觉问题。
我运行了 SurveyData <- readxl::read_excel(file.choose()),它显示一个窗口指向正确的文件夹,但我看不到任何名称,甚至看不到窗口按钮上的文本,就像M Aurélio所显示的。

我已尝试过:

  • 更新了R(现在是4.3.1)
  • 更新了RStudio(现在是2023.06.2+561)
  • 重置图形驱动程序
  • 重新启动了RStudio和我的笔记本电脑

编辑:完成以上所有操作并再次重新启动可能已经解决了我的问题。

英文:

As per today, without having changed something, I also have this visual issue.
I ran SurveyData <- readxl::read_excel(file.choose()), and it shows a window to the right folder, but I can't see any names or even the text on the window buttons, like M Aurélio shows.

I have tried:

  • Updating R (now 4.3.1)
  • Updating RStudio (now 2023.06.2+561)
  • Resetting graphics drivers
  • Rebooting RStudio and rebooting my laptop

Edit: Doing all of the above and rebooting again might have fixed it for me.

答案2

得分: 1

以下是翻译好的内容:

因为还没有人通过将工作的解决方案放在答案中而不是评论中来回答这个问题,所以我将复制一些内容并为 @Faemaika 添加更多可能的解决方案,他似乎有相同的问题,但已经有人提到的解决方案对他没有帮助。

首先,正如Mikael Jagan所说,尝试从命令行而不是从RStudio运行 base::file.choose()
如果这样可以正常工作,尝试升级R到最新版本。它应该至少是4.3.0,但在我写这篇文章的时候,我们正在使用R 4.3.1,它应该也可以正常工作。然后,file.choosechoose.files 已经足够新。

其次,如果这不起作用,请打开应用程序 '文件资源管理器' 并在使用RStudio中的 file.choose 函数时保持它处于打开状态。

第三,如果问题仍然存在,请检查你的RStudio文件选择器当前是否位于可访问的路径。如果你最后打开的文件的路径现在已经过时,文件选择器可能会难以打开任何路径。你可以通过手动打开一个随机文件,使用 Ctrl + O 并单击某个随机文件来解决此问题。然后重试 file.choose

第四,你可以考虑重新启动计算机/RStudio。这可能只在多次尝试后才能起作用;不要太快放弃。

祝你好运!

英文:

As no one has yet answered this question by putting the working solutions in an answer instead of a comment, I will copy some and add more possible solutions for @Faemaika who seems to have the same problem, but for who the stated solutions do not help.

Firstly, as Mikael Jagan stated, try running base::file.choose() from the command line, rather than from RStudio.
If this works well, try upgrading R to the latest version. It should be at least 4.3.0, but at the moment of writing we are in R 4.3.1 for which it should work too. Then, file.choose and choose.files are up to date enough.

Secondly, if this does not work, open the app 'file explorer' and keep it open while using the file.choose function in RStudio.

Thirdly, if the problem still persists, check if your RStudio file chooser is currently located to a path which is accessible. If you last opened a file to which the path is now depricated, the file chooser might struggle with opening any path at all. You can solve this by manually opening a random file by using Ctrl + O and clicking some random file. Then retry file.choose.

Fourthly, you might consider to reboot your pc/RStudio. This may work only after multiple times; do not give up too soon.

Good luck!

答案3

得分: 0

根据@Mikael Jagan的评论,更新R解决了这个问题。

英文:

Per the comment from @Mikael Jagan, updating R solved this issue.

答案4

得分: 0

Interestingly, if you could successfully run the following command prior to the execution of the Shiny application, it would work like a charm...! Don't know why... :p

base::file.choose()

英文:

Interestingly, if you could successfully run the following command prior to the execution of the Shiny application, it would work like a charm...! Don't know why... :p

base::file.choose()

huangapple
  • 本文由 发表于 2023年3月31日 03:13:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/75892124.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定