[Rd] nlme: bug in getCovariateFormula (PR#1038)

Setzer.Woodrow@epamail.epa.gov Setzer.Woodrow@epamail.epa.gov
Tue, 31 Jul 2001 17:47:14 +0200 (MET DST)

I found that predict.gnls failed with a wierd error message about a
non-numeric argument to a binary vector in one of three nearly identical

Error in Inh/Ki : non-numeric argument to binary operator

(Inh and Ki are arguments to the function used in the formula for the
object whose predictions were requested).

It turns out that the problem is in getCovariateFormula().

The final line in getCovariateFormula() in the nlme package (version
3.1-16) is:
    eval(parse(text = paste("~", deparse(form))))

however, if deparse(form) exceeds 'width.cutoff (which defaults to 60)',
this results in inappropriately placed "~" signs:
For example, in my application with the error, form is

UnCompetitive(MethoxyresorufinConc, InhibitorConc, Vmax, Km, Ki)

the result of the paste() operation in the last line of getCovariateFormula

> paste("~",deparse(form))
[1] "~ UnCompetitive(MethoxyresorufinConc, InhibitorConc, Vmax, Km, "
[2] "~     Ki)"

extending width.cutoff gives the intended value:

> paste("~",deparse(form,width.cutoff=500))
[1] "~ UnCompetitive(MethoxyresorufinConc, InhibitorConc, Vmax, Km, Ki)"

Seems a bit risky for an enforced cutoff in deparse, though.

R. Woodrow Setzer, Jr.                                            Phone:
(919) 541-0128
Experimental Toxicology Division                       Fax:  (919) 541-5394
Pharmacokinetics Branch

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