Hello,
There are several things wrong with your code and they come from copying
code found online without really understanding what it is doing.
1. To rbind NULL with any object will give that object, the NULL object
will not matter. Therefore, rbind is doing pratically nothing. If the
second object is a numeric vector, the return value will be that numeric
vector coerced to matrix.
importance <- NULL
rbind(importance, <any numeric vector>)
2. As for the error message, it's saying that there are no methods
anova.train
anova.train.formula
To see the methods for 'anova' run
methods("anova")
Hope this helps,
Rui Barradas
?s 22:36 de 24/12/20, javed khan escreveu:> Greetings to everyone
>
> I read online about this code:
>
> importance=NULL
> m= glm (......)
> imp= rbind(importance, anova(m, type="2",
test="LR"))$"LR Chisq")
>
> but I am using caret:
> model <- train(act_effort ~ ., data = tr,
> method = "rpart",
> tuneLength = 15,
> metric = "RMSE",
> trControl = ctrl)
> And when I am using like the following,
>
> importance=NULL
> m= glm (......)
> imp= rbind(importance, anova(model, type="2",
test="LR"))$"LR Chisq")
>
> It gives me the error:
>
> Error in UseMethod("anova") :
> no applicable method for 'anova' applied to an object of class
> "c('train', 'train.formula')"
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>