rstudio 增加控制台行限制

rstudio increase console line limit

我正在 运行 进行一系列冗长的分析,RStudio 控制台仅显示最后 1,000 行的结果,我需要大约 30,000 行才能一次查看所有结果。我试图通过将全局选项中的默认值 1,000 更改为 30,000 来调整控制台行限制,但仍然没有成功。有没有其他方法可以增加控制台行数限制(可能使用一些代码)?

出于性能原因,控制台的长度目前似乎受设计限制:

"The reason the console is limited to 1,000 lines is that, on most systems, RStudio's interface slows down considerably when the console grows too large. In a future version of RStudio, we hope to implement virtual scrolling for the console, so that it can grow without slowing down the interface." (jonathan from Rstudio 2017-12-11, https://community.rstudio.com/t/more-than-1000-lines-output-in-r-studio-console/3288/2)

我使用的解决方法是将超长的控制台输出保存到一个文本文件中,然后从那里开始工作。当您执行代码时,替换 ... 的命令产生的任何输出都将保存到文本文件中。

setwd("C:/My Output Folder")
sink(file='myoutput.txt')
...
sink()