[R] skipping an error message

Jim Lemon jim at bitwrit.com.au
Mon Apr 7 00:51:54 CEST 2014


On 04/06/2014 08:21 PM, Naser Jamil wrote:
> Dear R-user,
> May I seek your suggestion on an issue. I'm fitting non-linear mixed effects
> model as a part of my large R program. But sometimes I get error messages
> from it and the code stops working. In such cases, I want to skip the
> iterations and
> want to move to the next iteration ignoring all the subsequent
> computations.
>
> The following is only that part of the code which fits the mixed effects
> model. I tried with "tryCatch" as shown below, but it's not serving my
> purpose. I guess something is wrong in my approach.
>
> ###########################################################
>
> grouped.data<-groupedData(formula = conc ~ t | subject,
> data = data.d)
> model.d<-nlme(conc~f2(dose,Theta1,Theta2,Theta3,t),
> fixed=Theta1+Theta2+Theta3~1,
> data=grouped.data,
> random=Theta1+Theta2+Theta3~1,
> start=list(fixed=ini.pkpara))
> summ<-summary(model.d) # summary of the model
>
> tryCatch(summ, error = function() next)
>
> ###########################################################
>
Hi Jamil,
I think you have to pass the expression:

nlme(conc~f2(dose,Theta1,Theta2,Theta3,t),
  fixed=Theta1+Theta2+Theta3~1,
  data=grouped.data,
  random=Theta1+Theta2+Theta3~1,
  start=list(fixed=ini.pkpara))

not the result of the expression.

Jim




More information about the R-help mailing list