Running multiple glm models on mixed data with purrr
问题 Suppose we have a toy data set: library(tidyverse) library(purrr) tbl <- tibble(a = rep(c(0, 1), each = 5), b = rep(c(0, 1), times = 5), c = runif(10), d = rexp(10)) %>% mutate_at(vars(1,2), as.factor) where a is a dependent variable and b:d are independent variables. The idea is to run glm model for each independent variable: glm(a ~ b, data = tbl, family = "binomial") glm(a ~ c, data = tbl, family = "binomial") glm(a ~ d, data = tbl, family = "binomial") My initial attempt goes as follows: