“R CMD Check依赖错误“条件长度大于1””

huangapple go评论67阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年5月17日 19:28:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/76271590.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定