I made a linear regression model by using the caret package with the code below
library(caret)
#Anscombe data is available on R
model_1<-train(
form=y1~x1,
data=anscombe,
method='lm',
trControl=trainControl(method='cv',number=3))
What I wanted to do is convert the model into a data frame using broom::tidy(model_1)
, but it throws an error
# Error: No tidy method for objects of class train
I think the problem is with the class of the caret's model, which is train()
instead of lm()
. Is there any way to tidy a train
object? Or should I convert the train
object into lm
first?