这是 R 3.5 中的错误吗? [英] Is this a bug in R 3.5?
问题描述
当我为 R 的 3.5 版调用 Rscript.exe 时,如果文件名或路径中有空格,则无法打开该文件.我用代码保存了 2 个文件:
When I call Rscript.exe for Version 3.5 of R, it is unable to open the file if the file name or path has a space in it. I saved 2 files with the code:
cat("6 * 9 相乘得到什么?")
作为 C:\foo bar.R 和作为 C:\foo_bar.R
当我在 DOS 命令窗口中尝试使用 3.4.3 和 3.5 版运行这些时:
When I in a DOS command window try to run these using version 3.4.3 and 3.5:
C:\>"C:\Program Files\R\R-3.4.3\bin\x64\Rscript.exe" "C:\foo bar.R"
What do you get when you multiply 6 * 9?
C:\>"C:\Program Files\R\R-3.4.3\bin\x64\Rscript.exe" "C:\foo_bar.R"
What do you get when you multiply 6 * 9?
C:\>"C:\Program Files\R\R-3.5.0\bin\x64\Rscript.exe" "C:\foo bar.R"
Fatal error: cannot open file 'C:\foo': No such file or directory
C:\>"C:\Program Files\R\R-3.5.0\bin\x64\Rscript.exe" "C:\foo_bar.R"
What do you get when you multiply 6 * 9?
C:\>
当我尝试在 R 版本 3.5.0 中运行名称中包含空格的文件时,出现致命错误,提示没有此类文件.
When I try to run the file with a space in the name in version 3.5.0 of R, there is a fatal error saying there is no such file.
推荐答案
谢谢 Edward Carney,我通过电子邮件向您列出的地址发送了电子邮件,并收到了 Tomas 的回复,确认这是一个错误,并在修复之前提供了解决方法:
Thanks Edward Carney, I emailed the address you listed, and got a response from Tomas confirming it is a bug, and providing a workaround until it is fixed:
在解决此问题之前的快速解决方法是添加一个额外的第一个没有空格的参数,例如
A quick workaround before this gets fixed is to add an extra first argument that has no space in it, e.g.
Rscript --vanilla "foo bar.R"
该问题存在于所有系统上,而不仅仅是 Windows.
The problem exists on all systems, not just Windows.
此问题现已在开发版本中得到纠正,并且在以下位置提供了适用于 Windows 的二进制版本:https://cran.r-project.org/bin/windows/base/rdevel.html
This has now been corrected in the Development version, and there is a binary build for Windows at: https://cran.r-project.org/bin/windows/base/rdevel.html
它也已在修补版本中得到纠正,并且在以下位置提供了适用于 Windows 的二进制版本:https://cran.r-project.org/bin/windows/base/rpatched.html
It has also been corrected in the patched version, and there is a binary build for Windows at: https://cran.r-project.org/bin/windows/base/rpatched.html
这篇关于这是 R 3.5 中的错误吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!