I am looking for a pretty way to see the statistical model summaries in R. In the following example, I want to see cyl_6 or cyl.6 instead of cyl6. How can I do that?
library(dplyr)
library(broom)
mean_mpg <- mean(mtcars$mpg)
# creating a new variable that shows that Miles/(US) gallon is greater than the mean or not
mtcars <-
mtcars %>%
mutate(mpg_cat = ifelse(mpg > mean_mpg, 1,0))
mtcars$cyl <- as.factor(mtcars$cyl)
model <-
mtcars %>%
select (cyl,vs, am, mpg_cat) %>%
glm(formula = mpg_cat ~ .,
data = ., family = "binomial")
tidy(model)