[R] overshoot of formula line in summary output of Sweave

Ben Bolker bolker at ufl.edu
Wed Jun 17 23:53:19 CEST 2009




Ken Knoblauch wrote:
> 
> Hi,
> 
> In the Sweave output for summary for several types
> of model objects and also for the comparison of models
> with anova, I find that that the display of the call(s)
> or formula does not obey the width option, even with
> keep.source=TRUE set, so that a long formula will overshoot
> the margins in the document.  I would like to know if
> there is a good way to correct that.  Looking at the
> print.summary methods for lm, glm and several others,
> I see that a construct like deparse(obj$call) is used
> to generate the text.  The deparse function takes a
> "width.cutoff" argument, that could be used in these cases,
> if it were possible to pass a value to it, or if its default
> value could be set with an option.  Other methods do not
> use deparse, (print.summary.polr in MASS uses dput and
> anovalist.nls also does it differently) so such a solution
> would not work universally without altering these functions.
> 
> Here is a toy example that illustrates the overshoot of the formula
> 
> \documentclass[12pt]{article}
> \usepackage{geometry}
> \geometry{left=2in,right=2in}
> \begin{document}
> <<keep.source=TRUE>>=
> op <- options(width = 65, digits = 3)
> ddataframe <- data.frame(AAAAA = 1:10,
> 	BBBBB = factor(letters[1:2]),
> 	CCCCC = factor(LETTERS[1:5]),
> 	SSSSS = factor(paste("S", 1:10, sep = "")),
> 	RRRRR = rnorm(10))
> 
> mod1 <- lm(RRRRR ~ AAAAA + BBBBB + CCCCC + SSSSS,
> 	ddataframe)
> summary(mod1)
> @
> \end{document}
> 
> I have attached the pdf output.
> 
> Thanks, in advance, for any suggestions.
> 
> Ken
> 
> 
> 

A quick guess:  try keep.source=TRUE and format your commands
as you would like to see them appear ...

  Ben Bolker

-- 
View this message in context: http://www.nabble.com/overshoot-of-formula-line-in-summary-output-of-Sweave-tp24053269p24082795.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list