I have a linear regression which uses cities as groups in R:
pop_model <- lmList(Value ~ Year | City, data = df)
I can make a vector of corresponding R-Squareds using this:
r_squareds <- summary(pop_model)$r.squared
But this does not give me the names of Cities. So, I don't know which R-Squared is for which regression. How can I make a table to record these R-Squareds together with their names into a dataframe to get a dataframe like this?:
City | R-Squared