Generalized additive model data.frame.default error: attempting to apply nonfunction

风流意气都作罢 提交于 2019-12-02 02:20:22

The problem is this

na.action = TRUE

na.action requires a function and you passed it a logical, (from ?bam)

na.action: a function which indicates what should happen when the data contain NAs. The default is set by the na.action setting of options, and is na.fail if that is unset. The factory-fresh default is na.omit.

Essentially, within model.frame() you were basically asking R to evaluate

TRUE(df)

which rightly throws an error as TRUE isn't a function yet was being called as one.

If you want to omit rows with NAs rather than fail if they occur, use

na.action = na.omit
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!