CVlm {DAAG}:设置 printit = FALSE 导致问题 - 未找到对象 'sumss'

CVlm {DAAG}: setting printit = FALSE causes an issue - object 'sumss' not found

我正在使用 CVlm {DAAG},我想设置 printint=FALSE,因为默认设置为

printit if TRUE, output is printed to the screen

我试图运行将plotitprintit的函数FALSE改成FALSE,但后来我发现错误:sumss 未找到变量.

有没有办法将 printitplotit 实际设置为 FALSE,因为我不想在屏幕上打印情节和 table?

关于最新的 DAAG_1.22 更新于 2015 年 9 月 3 日

放心,您发现了 CVlm {DAAG} 的错误。我确定您已将 printitplotit 都设置为 FALSE,从而重现了该问题。考虑以下可重现的示例:

library(DAAG)
CVlm(printit = FALSE)  ## OK, plot generated, no ANOVA table printed
CVlm(plotit = FALSE)  ## OK, ANOAV table printed, no plot generated
CVlm(printit = FALSE, plotit = FALSE)  ## Oops...
# Error in CVlm(printit = FALSE, plotit = FALSE) : object 'sumss' not found

现在,快速扫描源代码就会发现问题所在。局部变量 sumss 定义在:

if (printit | plotit) {
    sumss <- 0
    sumdf <- 0
    ## ...blablabla
    }

printitplotit 需要 TRUE 来声明和初始化 sumss。然而,在 CVlm:

的最后
attr(data, "ms") <- sumss/sumdf
attr(data, "df") <- sumdf

没有if保护他们的条件。因此,当您到达这些行时,您会收到 "variable not found" 错误。

我不是包的作者或维护者,所以我不热衷于解决这个问题。我只是建议你保留 plotit = TRUE.


我看到了您为澄清问题所做的新编​​辑。如果您既不想绘图也不想打印,则必须自己修改 CVlm 函数,删除上面提到的两行 attr 。看起来包作者并不热衷于维护这个包,所以要求修复错误似乎很绝望。

使用devtools::install_github('gokceneraslan/DAAG')安装固定版本。