Hello,
I'm trying to obtain the AIC and BIC from a linear regression using purr (I'm learning purrr...)
This is what I can do:

Getting the AIC

mtcars %>%
group_split(cyl)%>%
map(~ lm(wt~qsec, data = .)) %>%
map(AIC)

Getting the BIC

mtcars %>%
group_split(cyl)%>%
map(~ lm(wt~qsec, data = .)) %>%
map(BIC)

But I don't know how to insert the two criteria in one line. Something like:
Getting the AIC and BIC together

mtcars %>%
group_split(cyl)%>%
map(~ lm(wt~qsec, data = .)) %>%
map(AIC,BIC)

Another issue, It's I don't know how to export the coefficients from each model :

mtcars %>%
group_split(cyl)%>%
map(~ lm(wt~qsec, data = .)) %>%
map("coefficients")

How can store that code in order to export It to an excel file?
(I know how to export to excel, but I can't transform the list in something more easy to manipulate?)

Thanks for your time and interest.
Also thank you for your patience.

I'll read them. I hope I can make some progress.
I read that broom was built in order to print/retrieve information in a tidy way.
Nice package broom. It seems simple and direct.