Message-ID: <CAAmySGNz3tXKpRLHBcf2RODjKy3q-X-wHahEmPu-1EA59J5NTA@mail.gmail.com>
Date: 2011-11-29T12:15:11Z
From: R. Michael Weylandt
Subject: simplify source code
In-Reply-To: <4ED4C9B1.8020007@email.uni-kiel.de>
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.
>