【发布时间】:2021-02-10 04:05:04
【问题描述】:
我遇到了一个问题,如果我尝试通过 RStudio 编辑文件,该文件
替换为包含文本“NULL”的内容。我首先注意到这是
当我使用fix() 并出现语法错误时发生了,但进行了一些实验
导致我这就是原因。
为了说明,这里首先是 RStudio 中的一个会话不是,而是Rgui 应用程序
R自带的:
> edit(file = "temp.R")
[1] "There is stuff in this file" "extending over two lines."
>
> scan(file = "temp.R", what = "", sep = "\n")
Read 2 items
[1] "c(\"There is stuff in this file\"," " \"extending over two lines.\")"
现在我将在 RStudio 中查看这个文件。
> scan(file = "temp.R", what = "", sep = "\n")
Read 2 items
[1] "c(\"There is stuff in this file\"," " \"extending over two lines.\")"
>
> edit(file = "temp.R")
这是我看到的:
[此时我点击“取消”按钮]
然后我又读了一遍文件:
> scan(file = "temp.R", what = "", sep = "\n")
Read 1 item
[1] "NULL"
所以...它不仅没有检索文件的内容,而且还忽略了我取消编辑的事实。所以我的文件被破坏了,没有办法取回它。这真的不太好。谁能告知发生了什么?我在 Windows 下使用 RStudio 版本 1.3.1093(最新版本)。
我在两个界面中运行相同的已安装 R,版本 4.0.3(最新版本)。以下是 Rgui 的会话信息:
> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.0.3 parallel_4.0.3
这里是 RStudio 的会话信息:
> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.0.3 htmltools_0.4.0 tools_4.0.3 parallel_4.0.3 yaml_2.2.1
[6] Rcpp_1.0.4.6 rmarkdown_2.2 knitr_1.28 xfun_0.14 digest_0.6.25
[11] rlang_0.4.6 evaluate_0.14
【问题讨论】:
-
顺便说一句,我在 RStudio 中卸载了几个命名空间,以便
sessionInfo()结果相同。这并没有解决问题。 -
可以复制(同样在 Windows 上,相同的 RStudio 版本)。我想提交一个错误报告并避免调用 RStudio 的内部编辑器,直到它被修复。
-
@27ϕ9 谢谢 - 很高兴知道我并不孤单!我不知道如何提交错误报告。我会继续努力找出答案。
-
因其他活动中断,但现在报告为issue #8209
-
@27ϕ9 我有一个解决方法。看我的回答