From ken.knoblauch at inserm.fr  Mon Feb  1 17:18:56 2010
From: ken.knoblauch at inserm.fr (Ken Knoblauch)
Date: Mon, 01 Feb 2010 17:18:56 +0100
Subject: [Rd] update method for nls
Message-ID: <20100201171856.by70lhz74s8k0ok8@imp.inserm.fr>

Would it be useful to have an update method for nls?
I learned recently that the default method can generate an error unless
the rhs of a formula is protected by being wrapped in
a function, such as log or I(), when terms.formula is called.

https://stat.ethz.ch/pipermail/r-help/2010-January/225822.html

https://stat.ethz.ch/pipermail/r-help/2010-January/225837.html

Would the following be a useful way to ensure this?

update.nls <- function(object, formula, ...){
	formula <- if(!missing(formula)){
	  tmp <- formula[[3]]
	  formula[[3]] <- as.call(list(as.name("I"), as.call(tmp)))
	  formula
	}
	NextMethod("update", ...)
}

Ken



-- 
Ken Knoblauch
Inserm U846
Stem-cell and Brain Research Institute
Department of Integrative Neurosciences
18 avenue du Doyen L?pine
69500 Bron
France
tel: +33 (0)4 72 91 34 77
fax: +33 (0)4 72 91 34 61
portable: +33 (0)6 84 10 64 10
http://www.sbri.fr/members/kenneth-knoblauch.html



[Rd] update method for nls
Ken Knoblauch