I am struggling with printing results from “summary.glm” to a CSV file. My code, which is rather simple, is as follows:
results <-glm(dv ~ iv + iv2, family=binomial, data=dataframe)
results_df <-summary.glm(results)
write.csv(results_df, "myCSV.csv")
This yields the error: cannot coerce class 'summary.glm' into a data.frame'.
All that I really need to do is export my coefficients, as odds ratios, into a CSV file that also includes standard errors and p-values. I’m sure there is a package to do this; I just haven’t found it. Please help!
Just do:
This extracts the coefficients data frame.