[R] simplify source code

Christof Kluß ckluss at email.uni-kiel.de
Tue Nov 29 13:01:53 CET 2011


Hi Dennis,

thank you very much. That works fine.

Is there a possibility that R continue even if one of the models is not 
solvable? R currently terminates with an error message.

greetings
Christof


Am 27-11-2011 01:34, schrieb Dennis Murphy:
> vars<- c('y1', 'y2', 'y3')
>
> # Function to create the model formula by plugging in the
> # response y and run the model
> mfun<- function(y) {
>       form<- as.formula(paste(y, 'cbind(1, exp(x/th))', sep = ' ~ '))
>       nls(form, data = dg, start = list(th = 0.3), algorithm = 'plinear')
>      }
>
> # Generate a list of model objects:
> mlist<- lapply(vars, mfun)



More information about the R-help mailing list