At the moment when I start up an ESS buffer (with M-x 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.
Asked
Active
Viewed 618 times
7
-
4Don't know, but does `options("width")` help? – Ben Bolker Sep 20 '12 at 20:38
2 Answers
7
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)
})

Dirk Eddelbuettel
- 360,940
- 56
- 644
- 725
-
Oh hey again Dirk! Awesome, what does AER page vii stand for in your second option? Just curious.. – Palace Chan Sep 20 '12 at 22:34
-
1I'm guessing "Applied Econometrics with R" (google hit number 1 on "AER R books") – Ben Bolker Sep 20 '12 at 22:40
-
:-) Ben and Google guessed right; the book by Achim and Christian uses that for its code examples and it grew on me. – Dirk Eddelbuettel Sep 20 '12 at 23:07
7
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 C-c 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.

VitoshKa
- 8,387
- 3
- 35
- 59
-
-
If there's ever a solution that allows it to be executed every time the window changes size, it would be so good! That's the default behavior in RStudio as well. – Heisenberg Mar 26 '17 at 02:24