From p.dalgaard@biostat.ku.dk  Tue Jul 31 17:21:46 2001
From: p.dalgaard@biostat.ku.dk (Peter Dalgaard BSA)
Date: 31 Jul 2001 18:21:46 +0200
Subject: [Rd] nlme: bug in getCovariateFormula (PR#1038)
In-Reply-To: Setzer.Woodrow@epamail.epa.gov's message of "Tue, 31 Jul 2001 17:47:14 +0200 (MET DST)"
References: <200107311547.RAA10368@pubhealth.ku.dk>
Message-ID: <x2d76h6pd1.fsf@blueberry.kubism.ku.dk>

Setzer.Woodrow@epamail.epa.gov writes:

> 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
> is:
> 
> > 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.

parse(...deparse(...)) always looks wrong to me anyway. Couldn't one
use something like

f <- ~1
f[[2]] <- form
eval(f)

or 

eval(as.call(list(as.name("~"),form)))

or

eval(substitute(~form)) # that's not going to work in S, though...

??

(What is the eval for? Doesn't usually do anything to a
formula argument.)
-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


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