我正在使用 CVlm {DAAG}
我想设置 printint=FALSE
因为默认说
printit if TRUE, output is printed to the screen
我试图同时运行该函数
plotit
和 printit
至 FALSE
但后来我发现了错误: sumss
未找到变量 .有没有办法实际设置
printit
和 plotit
至 FALSE
因为我不想在屏幕上打印情节或表格?
最佳答案
关于2015年9月3日更新的最新DAAG_1.22
放轻松,您发现了 CVlm {DAAG}
的错误.我相信你已经设置了 printit
和 plotit
至 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
}
即,要么
printit
和 plotit
需要TRUE
声明和初始化 sumss
.然而,在CVlm
的最后:attr(data, "ms") <- sumss/sumdf
attr(data, "df") <- sumdf
没有
if
条件来保护他们。因此,当您到达这些行时,您会收到“未找到变量”错误。我不是包作者或维护者,所以我不热衷于解决这个问题。我只是建议你保留
plotit = TRUE
.我看到你的新编辑来澄清这个问题。如果你既不想打印也不想打印,你必须修改
CVlm
通过删除两个 attr
来实现自己的功能上面提到的线路。看起来包作者并不热衷于维护这个包,所以要求修复错误似乎是绝望的。
关于r - CVlm {DAAG} : setting printit = FALSE causes an issue - object 'sumss' not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40700867/