I just discovered wid <- options()$width in RStudio, and it seems to be the source (or rather, much closer to the source) of a lot of annoyance in my everyday use of the console. I have to say that I am now on R 3.2.2, RStudio 0.99.491, on Linux Mint 17.3 (built on Ubuntu 14.04.3 LTS)
As I understand it, wid should be measured in characters - if wid is 52, say, then you should be able to put the alphabet on the screen twice (given the default font with a fixed width), but it does not look like this:

As you can see, despite the fact that wid is 52, I am unable to match the alphabet twice - I am typing 6 characters. I also note that this means that this is not only due to the presence of the command line arrow and space ( > ).
The problem seems somewhat proportional - if I have a wid up to 78, I can only match 70 characters; up to 104, 93, so wid about 88% pretty stable (side note: this also suggests that my assumption wid is measured in characters is probably correct).
The problem that this gives rise to is that often the overflow of the console output goes beyond its intended line, which makes the output ugly and difficult to digest; take, for example, a simple cut-off setDT(lapply(1:30, function(x) 1:3))[] , which produces for me:

It seems to me that the result was made on the width of the screen, which was not available in practice - a larger screen width was used for internal printing than actually.
This leaves me with three questions:
- How is
options()$width defined? - Why is this so inappropriate?
- What can we do to override this error?
source share