I am new to RStudio and I guess my question is pretty easy to solve but a lot of searching did not help me.
I am running a regression and summary(regression1) shows me all the coefficients and so on.
Now I am using coef(regression1) so it only gives me the coefficients which I want to export to a file.
write.csv(coef, file="regression1.csv) and the "Error in as.data.frame.default(x[[i]], optional = TRUE) : cannot coerce class ""function"" to a data.frame" occurs.
Would be great If you could help me. I am searching the web for a few hours now and was not successful.
Do I have to change coef somehow so it fits in a data.frame?
Thank you very much!
解决方案
There's a contributed package called broom that simplifies this task, it converts model output to tidy dataframes. Here's a self-contained repro