Rstudio 的控制台在交互模式测试时卡住了
Rstudio's console stuck while interactive mode testing
我尝试在 Rstudio 中测试交互模式:
ans <- readLines("stdin", n = 1)
print(ans)
但是控制台卡住了,不接受任何命令。在那之后我什至无法退出这种模式,不得不重新启动整个 Rstudio。
我做错了什么?
从 stdin()
读取,而不是 file("stdin")
:
ans <- readLines(stdin(), n = 1)
来自 ?stdin
:
stdin()
refers to the 'console' and not to the C-level stdin
of the process. The distinction matters in GUI consoles (which may not have an active stdin
, and if they do it may not be connected to console input), and also in embedded applications. If you want access to the C-level file stream stdin
, use file("stdin")
.
我尝试在 Rstudio 中测试交互模式:
ans <- readLines("stdin", n = 1)
print(ans)
但是控制台卡住了,不接受任何命令。在那之后我什至无法退出这种模式,不得不重新启动整个 Rstudio。 我做错了什么?
从 stdin()
读取,而不是 file("stdin")
:
ans <- readLines(stdin(), n = 1)
来自 ?stdin
:
stdin()
refers to the 'console' and not to the C-levelstdin
of the process. The distinction matters in GUI consoles (which may not have an activestdin
, and if they do it may not be connected to console input), and also in embedded applications. If you want access to the C-level file streamstdin
, usefile("stdin")
.