I am not clear how to follow this, please clarify
So, I have created 200+ models & I just want to put them in a list & pass to map(tidy), I know how to do it manually, its as below, however I cant manually add 200 names as below, looking for a better solution (I guess something with deparse, evaluate or {{}}). They are named model1, model2... model200
library(tidyverse) model1 <- lm(Sepal.Width~Sepal.Length,data=iris) model2 <- lm(Sepal.Width~Sepal.Length+Petal.Width,data=iris) model3 <- lm(Sepal.Width~Sepal.Length+Petal.Length,data=iris) model4 <- lm(Petal.Length~Sepal.Length,data=iris) model5 <- lm(Petal.Width~Sepal.Length,data=iris) model6 <- lm(Petal.Length~Sepal.Length+Petal.Width,data=iris) list(model1,model2,model3,model4,model5,model6) %>% map(tidy)
forms <- list(Sepal.Width~Sepal.Length, Sepal.Width~Sepal.Length+Petal.Width, Sepal.Width~Sepal.Length+Petal.Length, Petal.Length~Sepal.Length, Petal.Width~Sepal.Length, Petal.Length~Sepal.Length+Petal.Width)you should even easily pipe that tolm:forms |> lapply(lm, data=iris) |> purrr::map(broom::tidy)mget(ls(pattern = '^model'))to get a list of all the objects in the global environment that start with "model". Just make sure no other variables that you don't want to use also start with that string. Thepattern=argument can take any regular expression so you can change that if you need it to be more specific.