Running multiple regressions and outputting them to a table

Was wondering if anyone might have some advice or be able to point me in the right direction with this problem. I ran multiple regression models (each for a different region) and I have the data in a nested data frame I know how to extract the individual coefficients, p.value etc. using broom and glance but I want to create a separate regression table to display the results of each of these regressions. I've been using the package stargazer with the following code to make individual regression tables stargazer(model_3, title = "Regression Results", type = "html", out = "regression4.html") I just don't know how to change the name in the out option to a function something like .x so that each regression table saves as its own distinct name. Let me know if you have any thoughts or if this is possible.

You can do something like this

library(tidyverse)
library(stargazer)

iris %>% 
  group_nest(Species) %>% 
  mutate(model = map(data, ~ lm(Sepal.Length ~ Sepal.Width, data = .x))) %>% 
  walk2(.x = .$model,
        .y = .$Species,
        .f = ~stargazer(.x, title = "Regression Results",
                    type = "html",
                    out = paste(.y, ".html")))

Thank you so much!! One additional follow-up - alternatively if I am trying to make each regression model (per region) a different column in one stargazer table how can I go about doing this. The stargazer function for multiple models in one table is just stargazer(model_1, model_2, model_3, title = "Regression Results", type = "html", out = "regression4.html")

You can do something like this

library(tidyverse)
library(stargazer)

iris %>% 
  group_nest(Species) %>% 
  mutate(model = map(data, ~ lm(Sepal.Length ~ Sepal.Width, data = .x))) %>% 
  pull(model) %>% 
  stargazer(title = "Regression Results",
                    type = "html",
                    out = "all_regressions.html")