相关:Dynamic column resizing in .Rprofile
如果我尝试将 Sys.getenv("COLUMNS")
作为整数(或数字或原样,即作为字符串)传递给参数 width
在我的用户 .Rprofile 中的 options()
中,启动时出现错误:
Error in options(width = as.integer(Sys.getenv("COLUMNS"))):
invalid 'width' parameter, allowed 10...10000
但是,如果登录到交互式 session 后,我手动尝试相同的操作,则不会引发任何错误,并且 getOption("width")
返回与 as.integer( Sys.getenv("COLUMNS"))
.
我想知道为什么它在我的 .Rprofile 中不起作用,特别是因为 Startup 帮助页面上给出的示例中出现了类似的内容。我在 xterm 中使用 R,在 Linux (Arch) 上使用。
最佳答案
也许setwidth
包可以帮助你:http://cran.r-project.org/web/packages/setwidth/index.html
它适用于在 Linux 上的交互式终端上运行的 R(听起来与您的情况完全一样)。
您只需将 library(setwidth)
添加到您的 .Rprofile 中,每次调整终端大小时它都会更改宽度。
关于r - 在 Rprofile 中设置 `width`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26592082/