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!
write.csv(as.data.frame(summary(regression1)$coef), file="regression1.csv)
– Rolandwrite.csv2
. Otherwise you need to take care to import the data correctly to Excel (e.g., specify the column seperator in Excel). That's not an R problem. – Roland