I have a dataframe with 13 columns. One is the predictor and rest of them are response variables. I want to fit a regression model to all the columns. I used the following code,
reg <- lapply( birthData[,-1], function(y) lm(y ~ birthData$Year) )
The problem is I have saved the coefficients in a variable and now I want to display the output as,
Intercept birthData$Year
Column A value value
Column B value value
.
.
.
.
So that it would be useful to display the results. Can anybody help me in doing this. The problem I am facing here is, I have to use reg$columnA$coefficients
to get the values for the first column and for all the columns it is lot of coding. Is there a easy way to save it?