Monday, February 20, 2017

Export GAM, GLM and LM summary to CSV file

Here I am posting a function to export Linear Model (lm), Generalized Linear Model (GLM), and Generalized Additive Model (GAM) summary outputs from R to CSV excel file. The function is customized from someone else, exactly don't the source at the moment, I will cite it latter.

Run the function in R as follow, it won't display any result when the function runs.  However, it will prepare the function to make it ready.

First download it from here (or https://goo.gl/oVh0M8). 


Then run it as follows. ("........." = file location path) in R.
source("........./LM and GLM summary export.R")

Then, run the function as below
Prepare your Linear Regression Model (LM) first, then run the command below to export summary:

lmOut(lm.model, "......./file name.csv")

For Generalized Linear Model (GLM) summary:
glmOut(glm.model, "....../file name.csv")

For Generalized Additive Model (GAM) model summary:
gamOut(gam.model, "......./file name.csv") 

Good luck