简体   繁体   中英

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). 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:

(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 .

Also in the latest ESS you can execute this with Cc h w RET , or alternatively bind it to a handy key:

(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.

Ben Bolker's comment is correct: options("width"=200) is something I use on a machine with wide monitors.

I am not aware of an environment variable that reports this back to ESS to auto-adjust. 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

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)
})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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