I have been foll0wing the logistic regression chapter in Hands on Programing with R. As I started all the codes were working fine but then I retarted my R session and when I run this code
tidy(model1)
it throws this error message.
`Error in UseMethod("tidy") :
no applicable method for 'tidy' applied to an object of class "c('glm', 'lm')"`
so here are my codes up to where it throws the error
library(dplyr)
library(ggplot2)
library(rsample)
library(modeldata) #contains the attrition dataset
library(caret)
library(vip)
df <- attrition |>
mutate_if(is.ordered, factor, ordered=F)
#create training(70%) and test(30% sets )
set.seed(191) # for reproducibility
churn_split <- initial_split(df, prop =0.7, strata ='Attrition')
churn_train <- training(churn_split)
churn_test <- testing(churn_split)
#model simple logistic regression (use 1 variable for prediction)
model1 <- glm(Attrition ~ MonthlyIncome,
family ='binomial',
data = churn_train)
model2 <- glm(Attrition ~ OverTime,
family = 'binomial',
data = churn_train)
summary(model1)
exp(coef(model1))
all these codes work fine
and this tidy(model1)
was also working until I restarted R studio. I want to know if I did something or the function is just messing with me and how do I fix it