update method for nls

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

update method for nls

Kenneth Knoblauch
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

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel