gpt4 book ai didi

r - 转义 RStudio 中的 readLines() 函数

转载 作者:行者123 更新时间:2023-12-04 21:29:54 25 4
gpt4 key购买 nike

由于我用 R 做的工作,我需要使用 readline()输入文字的功能。有时会出现问题,而不是写 readline()我跑 readLines()意外(由于自动完成或任何原因)。

一旦我跑了 readLines() ,我无法逃避该功能。我可以继续写,但无法在控制台中恢复提示(无法运行任何代码),因为我不知道如何关闭 readLines()函数调用。有什么线索吗?

请注意,此问题仅发生在 RStudio 中(并且,根据评论中的 Matt 的说法,是 Visual Studio)。

enter image description here

最佳答案

不是完美的修复,但您可以使用 debug() .任何时候您最终都会调用 readLines()不小心,你可以退出browse[2]通过输入 Q .

debug(readLines)
readline()
asdf
[1] "asdf"
readLines()
debugging in: readLines()
debug: {
if (is.character(con)) {
con <- file(con, "r")
on.exit(close(con))
}
.Internal(readLines(con, n, ok, warn, encoding, skipNul))
}
Browse[2]> Q
readline()
asdf
[1] "asdf"

关于r - 转义 RStudio 中的 readLines() 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56115316/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com