[R] simplify source code
R. Michael Weylandt
michael.weylandt at gmail.com
Tue Nov 29 13:15:11 CET 2011
Look into tryCatch() for error handling.
Michael
On Tue, Nov 29, 2011 at 7:01 AM, Christof Kluß <ckluss at email.uni-kiel.de> wrote:
> 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)
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list