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. platform i386-pc-mingw32 arch x86 os Win32 system x86, Win32 status major 1 minor 2.2 year 2001 month 02 day 26 language R -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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. ><snip>> 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.The problem is in fixFormulaObject in terms.formula(). It uses deparse() on the lhs of the formula. A work-around is to change the line near the top of fixFormulaObject in terms.formula from else deparse(form[[2]]) to else deparse(form[[2]],width.cutoff=200) but this may not be the final solution -- we should have something without a width limit -thomas Thomas Lumley Asst. Professor, Biostatistics tlumley@u.washington.edu University of Washington, Seattle -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._