【发布时间】:2023-03-08 23:44:02
【问题描述】:
我正在尝试自动化我的 R 脚本以执行包含大量分析的循环,目前我已经搁浅了让它在失败的 CI 测试期间给我一个警告并继续执行下一个响应变量。我已经分别尝试过“tryCatch”和“try”。有人可以告诉我我做错了什么以及如何修改它吗?这可能是愚蠢的,但我花了数周时间试图解决它。如果我概括下面的代码会让人感到困惑,所以我将其保留为原始形式。
这是我得到的,这里是相关的错误-
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)
这是我想跳过的错误,但请注意:
Error in intervals.lme(tmpLme) :
Cannot get confidence intervals on var-cov components: Non-positive
definite approximate variance-covariance
这是我不想要的错误 - 它表明我试图跳过上述错误的尝试不起作用:
Error in int$fixed : $ operator is invalid for atomic vectors
然后就是这个尝试
int.model <- function(tmpLme)
int <- tryCatch(intervals(tmpLme), error=function(e) NULL )
-或-
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
提前致谢!
【问题讨论】:
标签: r