简体   繁体   English

如何在emacs中获取R缓冲区以占用更多水平空间?

[英]How do I get my R buffer in emacs to occupy more horizontal space?

At the moment when I start up an ESS buffer (with Mx R) I get that the output of my commands only occupies about 60ish characters in column width (particularly when displaying data frames with long column names). 在我启动ESS缓冲区(使用Mx R)的那一刻,我得到的命令输出仅占用列宽的大约60个字符(特别是在显示具有长列名的数据帧时)。 I was wondering if there was a simple way to adjust this limit. 我想知道是否有一种简单的方法来调整这个限制。

The following sets R's option "width" to the width of your buffer right on R's startup: 在R的启动时,以下将R的选项“width”设置为缓冲区的宽度:

(add-hook 'ess-R-post-run-hook 'ess-execute-screen-options)

Note that this works with the newest ESS 12.09, for older versions use ess-post-run-hook . 请注意,这适用于最新的ESS 12.09,旧版本使用ess-post-run-hook

Also in the latest ESS you can execute this with Cc h w RET , or alternatively bind it to a handy key: 同样在最新的ESS中,您可以使用Cc h w RET执行此操作,或者将其绑定到一个方便的键:

(define-key inferior-ess-mode-map "\C-cw" 'ess-execute-screen-options)

It could be set to execute each time the window changes it's size, but my guess is that it would require quite some lisping. 它可以设置为每次窗口改变它的大小时执行,但我的猜测是它需要相当多的lisping。

Ben Bolker's comment is correct: options("width"=200) is something I use on a machine with wide monitors. Ben Bolker的评论是正确的: options("width"=200)是我在具有宽显示器的机器上使用的。

I am not aware of an environment variable that reports this back to ESS to auto-adjust. 我不知道环境变量会将此报告回ESS进行自动调整。 It would be a useful addition. 这将是一个有用的补充。

And just like options("width") , a few things are generally useful at startup, so I currently have this on another machine 就像options("width") ,一些东西在启动时通常很有用,所以我目前在另一台机器上有这个

edd@max:~$ cat .Rprofile
## Example of .Rprofile
options(width=155, digits=6, digits.secs=6)
## AER page vii
options(prompt="R> ")
## Default repo
local({r <- getOption("repos")
       r["CRAN"] <- "http://cran.r-project.org"
       options(repos=r)
})

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM