I can run the same regression using different data frames using a pipe and loop (see below):
mtcars %>%
split(.$cyl) %>%
map(~ lm(mpg ~ wt, data = .x))
However, what if I am interested seeing results for the same regression but for a range of different dependent variables - e.g. "mpg", "hp", "drat". Is there a fast way to do this using loops?
I have tried using nested lapply loops, group_by etc. however, I can't seem to find a solution.
Any help would be great.