使用traceback
你可以本地化錯誤:
print(anova(object = iris.lm , type = "marginal"))
Error: $ operator is invalid for atomic vectors
> traceback()
7: deparse(x$terms[[2L]])
6: FUN(X[[2L]], ...)
5: lapply(objects, function(x) deparse(x$terms[[2L]]))
4: anova.lmlist(object, ...)
3: anova.lm(object = iris.lm, type = "marginal")
2: anova(object = iris.lm, type = "marginal")
1: print(anova(object = iris.lm, type = "marginal"))
,是因爲你試圖調用terms
一個對象,它不支持它在你的錯誤。此重現錯誤:
lapply(list(iris.lm,type='marginal'),terms)
Error: $ operator is invalid for atomic vectors
或者只是:
terms('marginal')
但是你爲什麼想到,這個工程?也許我會錯過一些東西,但我認爲沒有提到anova可以拿type
作爲論據。
也許你有這個與'nlme :: anova.lme'混淆? – rawr