I'm trying to automate my R script to do a loop with loads of analyses and currently I've run aground on getting it to give me a warning during a failed CI test and proceed to the next response variable. I've tried "tryCatch" and "try" separately. Can someone tell me what I'm doing wrong and how to amend it? It's probably something dumb but I've spent weeks trying to sort it out. If I generalize the code below it will get confusing so I've left it in its original form.
Here's what I've got and here are the associated errors-
int <- try(intervals(tmpLme))
if (inherits(int, "try-error"))
lme(tmp ~ I(log10(Body.mass..kg.)), random = ~1 | Species / CatNumber,
data=felids, na.action=na.omit )
lower <- dim(int$fixed)[1]
upper <- dim(int$fixed)[1]
felidCIlower <- append(felidCIlower, int$fixed[,1],lower)
felidCIupper <- append(felidCIupper, int$fixed[,3],upper)
This is the error I want to skip over but note:
Error in intervals.lme(tmpLme) :
Cannot get confidence intervals on var-cov components: Non-positive
definite approximate variance-covariance
This is the error I don't want - it shows my attempt to skip over the above error isn't working:
Error in int$fixed : $ operator is invalid for atomic vectors
Then there's this attempt
int.model <- function(tmpLme)
int <- tryCatch(intervals(tmpLme), error=function(e) NULL )
-or-
int <- tryCatch(intervals(tmpLme),
error=function(e) lme(tmp ~ I(log10(Body.mass..kg.)),
random = ~1 | Species / CatNumber,
data=felids,na.action=na.omit ))
lower <- dim(int$fixed)[1]
upper <- dim(int$fixed)[1]
felidCIlower <- append(felidCIlower, int$fixed[,1], lower)
felidCIupper <- append(felidCIupper, int$fixed[,3], upper)
Error in !after : invalid argument type
Thanks in advance!