我在r中使用ctree函数,如下所示:
model = ctree(fmla, data=dev, ctree_control(mincriterion=0.95, minbucket=100L, maxdepth=5))
但这会返回一个错误:
[.default
(xj,i)中的错误:无效下标类型'S4‘
我试过使用因子和数字因变量,但仍然是相同的错误。
有人知道是什么原因造成的吗?
发布于 2016-09-08 06:45:23
这是因为ctree()
的第三个参数是subset
,如果您使用的是party
包中的ctree()
。如果您使用的是ctree()
包中的partykit
,那么第三个参数将是weights
。
尝试显式地提供control
或controls
参数(取决于包),如
ctree(fmla, data = dev,
control = ctree_control(mincriterion = 0.95, minbucket = 100L, maxdepth = 5))
(无论您编写control
还是controls
,这里都没有什么区别)
https://stackoverflow.com/questions/39363182
复制相似问题