Bug 15708 - print.anova output can exceed options(width)
Summary: print.anova output can exceed options(width)
Status: CLOSED FIXED
Alias: None
Product: R
Classification: Unclassified
Component: Wishlist (show other bugs)
Version: R 3.0.2
Hardware: ix86 (32-bit) Linux
: P5 enhancement
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2014-03-10 11:35 UTC by Adrian Baddeley
Modified: 2014-04-10 19:13 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Baddeley 2014-03-10 11:35:50 UTC
The output from stats::print.anova can overrun the text width specified by options('width'). To see it easily:
      options(width=40)
      example(anova.lm)
The overrun occurs in the last line, the explanatory legend for the
significance codes. 

The legend is originally created by stats::symnum using paste(.... collapse=" ")
so that quite a long string may be created. 

Admittedly I could just switch off the legend by setting signif.legend=FALSE, but I'm trying to show typical R output in a book, and the text width of the R output in the book is 50 characters, which is exceeded by anova.glm.
Comment 1 Martin Maechler 2014-03-10 14:27:46 UTC
You are right, Adrian.

Note however that too small getOption("width") will ``break'' in many many other cases as well, e.g. the formulas in such (and other?) print() methods are also not split   [it would look a bit ugly anyway, when comparing, say 4 different models].

I will commit a fix shortly however, as this case is so nicely centralized in the
printCoefmat() function.

Martin