[R] how to set column width of terminal output?

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Dec 10 13:12:50 CET 2009


On Thu, 10 Dec 2009, Michael Olberg wrote:

> Hi,
>
> I am new to this list and my question may be trivial,

But the answer depends on the 'at a minimum' information requested in 
the posting guide.  My comments below only apply to the standard 
Unix-alike R and Rterm.exe.  Many other front-ends do set the width 
from the console/terminal width.

> I did however not find an answer to it using the help.search or 
> RSiteSearch features of R. This is my question:
>
> R seems to break lines of terminal output at a column which is independent of 
> how wide I have made my terminal. I would have expected R to honor the 
> COLUMNS environment variable, but that seems not to be the case. So is there 
> an R internal variable I have to configure, something like the fill-column of 
> emacs?
>
> If my terminal is wide enough to show a wide table, I want to be able to 
> print it like that and not have R print a first set of columns followed by a 
> second set.

?options, look for 'width'.  You could add something like

options(width=Sys.getenv("COLUMNS"))

to a startup file if you have COLUMNS set in your environment.


> thanks,
> Michael
>
> -- 
> Michael Olberg                           <michael.olberg at chalmers.se>
> SRON                                           tel: +31-(0)50-3638028
> Landleven 12, P.O.Box 800,                     fax: +31-(0)50-3634033
> NL-9700 AV Groningen, The Netherlands       mobile: +31-(0)63-1236953
> ----------------- This quote left blank intentionally ---------------

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list