[Rd] long formulas in terms() (PR#873)

Prof Brian D Ripley ripley@stats.ox.ac.uk
Fri, 9 Mar 2001 07:13:56 +0000 (GMT)


On Thu, 8 Mar 2001 jerome@stat.ubc.ca wrote:

> Full_Name: Jerome Asselin
> Version: 1.2.2
> OS: Windows 95
> Submission from: (NULL) (142.52.81.1)
>
>
>
> I need to use the "terms()" function to decompose a formula.
> The function seems to work for small formulas, but not for long formulas.
>
> ##############################
> #The following works!
> form <- cbind(log(inflowd1),log(inflowd2),log(inflowd3),
>     log(inflowd4)) ~ precip*I(Tmax^2)
> terms(form)
>
> #But enlarging the left-hand side of the formula causes an error!
> form <- cbind(log(inflowd1),log(inflowd2),log(inflowd3),
>     log(inflowd4),log(inflowd5),log(inflowd6)) ~ precip*I(Tmax^2)
> terms(form) # ERROR
> ##############################
>
> I noticed that when the left-hand side term of the formula is
> too large to be written on one line, an error occurs in terms().
> However, increasing the line width by "options(width=200)" did
> not solve the problem.

You can edit fixFormulaObject in terms.formula and set

deparse(form[[2]], width.cutoff = 500)

This still has a limit, but a much higher one.  Or write a shorter lhs?

deparse has been changed since that function was written, I believe,
but both a long time ago.

-- 
Brian D. Ripley,                  ripley@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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._