[Rd] update method for nls

Ken Knoblauch ken.knoblauch at inserm.fr
Mon Feb 1 17:18:56 CET 2010


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



More information about the R-devel mailing list