英文:
R CMD Check dependency error "the condition has length > 1"
问题
Recently, when running R CMD Check on my package, the following NOTE
begun appearing when running R CMD Check:
N checking dependencies in R code (880ms)
Error in if (pkg %notin% c(depends_suggests, common_names)) bad_exprs <<- c(bad_exprs, :
the condition has length > 1
Execution halted
None of my written functions uses the %notin%
operator. Where should I go about in the codebase to look for the error? Could this be a problem with one of the packages in dependencies or DESCRIPTION
? Here is a link to the github CI output of the R CMD Check if anyone's interested: GitHub链接
英文:
Recently, when running R CMD Check on my package, the following NOTE
begun appearing when running R CMD Check:
N checking dependencies in R code (880ms)
Error in if (pkg %notin% c(depends_suggests, common_names)) bad_exprs <<- c(bad_exprs, :
the condition has length > 1
Execution halted
None of my written functions uses the %notin%
operator. Where should I go about in the codebase to look for the error? Could this be a problem with one of the packages in dependencies or DESCRPTION
? Here is a link to the github CI output of the R CMD Check if anyone's interested: https://github.com/Qile0317/APackOfTheClones/actions/runs/5002483520/jobs/8962495554#step:5:92
答案1
得分: 1
这是代码中的一个错误,但它是由你的代码中的一个错误触发的。你在几个地方都有类似这样的代码:
suppressPackageStartupMessages(require(
packages[[i]], character.only = T
))
因为你使用了T
而不是TRUE
,所以触发了这个错误。T
是一个可能会改变的变量,而TRUE
是一个常数。你应该在你的代码中始终使用常数。我想检查代码正在用某个其他值替换T
,这导致了所有的混淆。
英文:
This is a bug in the check code, but it is triggered by a bug in your code. You have things like this in a couple of places:
suppressPackageStartupMessages(require(
packages[[i]], character.only = T
))
Because you used T
rather than TRUE
, the bug is triggered. T
is a variable which might change, whereas TRUE
is a constant. You should always use the constant in your code. I imagine the check code is replacing T
with some other value and that causes all the confusion.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论