The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Version: 1.1.0
Title: Automatically Set the Width Option on Terminal Emulators
OS_type: unix
Description: Automatically sets the value of options("width") when the terminal emulator is resized. The functions of this package only work if R is compiled for Unix systems and it is running interactively in a terminal emulator.
License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
NeedsCompilation: yes
Packaged: 2025-08-21 10:57:55 UTC; research
Author: Jakson Aquino ORCID iD [aut], Dominique-Laurent Couturier ORCID iD [aut, cre]
Maintainer: Dominique-Laurent Couturier <dominique.couturier@mrc-bsu.cam.ac.uk>
Repository: CRAN
Date/Publication: 2025-08-27 11:10:02 UTC

Automatically set the value of options("width") when the terminal emulator is resized

Description

This package automatically sets options("width") when using R in terminal windows on OSX primarily (but on Unix-like OSes too) and resizing the terminal (e.g., iTerm2 on OSX). It may be useful if options(setWidthOnResize=TRUE) does not work properly for any reason.

This package should not be used with graphical interfaces such as RStudio, RKward, JGR, Rcmdr, or any other interface that handles R output on its own, or when using R via remote sessions (like via a ssh connection, for example). The functions only work if R runs interactively in a terminal emulator. The terminal emulator may be called by a text editor like Vim, Gedit, Kate, or Geany.

Details

The package will print information on the R Console if its ‘⁠setwidth.verbose⁠’ option was set to a numeric value bigger than zero:

  options(setwidth.verbose = 1) # Print startup message
  options(setwidth.verbose = 2) # Print error message when unable to set width
  options(setwidth.verbose = 3) # Print width value
  

The package does not have any user visible R function. When it is loaded, the SIGWINCH signal starts to be handled by a C function that updates the value of options("width"). The handle will not be activated if interactive() == FALSE or the value of the environment variable ‘⁠TERM⁠’ is either empty or ‘⁠"dumb"⁠’.

To manually test whether the package is working properly on your system you may repeatedly resize the terminal emulator and print a long vector, like 1:300.

To disable the automatic setting of options("width") do:

  detach("package:setwidth", unload = TRUE)
  

Author(s)

Jakson Alves de Aquino and Dominique-Laurent Couturier

See Also

The package colorout colorizes R output when running in a unix/osx terminal emulators.

Examples

options(setwidth.verbose = 1)
print(getOption("width"))

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.