我在RStudio中保存了以下脚本:
a <- "中文"
print(a)
当我运行它时,出现以下错误:
Error in source("C:/Users/Rafael/Desktop/test.R", encoding = "UTF-8", :
C:/Users/Rafael/Desktop/test.R:21:6: unexpected INCOMPLETE_STRING
20:
21: a <- "
^
In addition: Warning message:
In readLines(file, warn = FALSE) :
invalid input found on input connection 'C:/Users/Rafael/Desktop/test.R'
这是sessionInfo()函数:
R version 3.3.3 (2017-03-06)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
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] tools_3.3.3
编辑:当我使用 RStudio 上的“源代码”按钮运行时,才会出现此问题。如果我选择文本块并选择“运行”,则问题不会持续。
sessionInfo()
。 - MichaelChiricoverbose = TRUE
运行会发生什么? - MichaelChirico