niceglm: Lisa's GLM Regression Table Function

Usage Arguments

View source: R/niceglm.R

Usage

1
2
3
4
5
niceglm(df, fit = NA, family = NA, covs = NA, out = NA,
  regtype = "multi", exp = NA, estname = NA, intercept = FALSE,
  labels = NA, overallp = FALSE, est.dec = 2, ci.dec = 2,
  pval.dec = 3, color = "#EEEEEE", printRMD = FALSE,
  printR2 = FALSE, htmlTable = TRUE)

Arguments

df

Dataframe [REQUIRED].

fit

GLM model object [fit or family/covs/out are REQUIRED].

family

Model family name in quotes ("guassian", "binomial", "poisson") [fit or family/covs/out are REQUIRED].

covs

Vector of covariates to include in model [fit or family/covs/out are REQUIRED].

out

Outcome for regression model [fit or family/covs/out are REQUIRED].

regtype

Should the covariates be run separately ("uni") or together in a multiple regression model ("multi") [REQUIRED if no fit].

exp

Option to exponentiate coefficients and CI's. Default is NA (estimates are only exponentiated for binomial and poisson family models by default).

estname

Option to override default estimate column name. Default is NA.

intercept

If TRUE the intercept will be included in the table. Default is FALSE.

overallp

If TRUE, a likelihood ratio test pvalue (using drop1 Chisq tests) will be calculated for each variable. Default is TRUE.

est.dec

Number of decimal places for estimates. Default is 2.

ci.dec

Number of decimal places for 95

\item

pval.decNumber of decimal places for pvalues. Default is 3.

\item

colorHex color to use for htmlTable output. Default is "#EEEEEE" (grey).

\item

printRMDWhether to print resulting table to Rmd via xtable. Default is FALSE

\item

printR2Whether to include R squared value in label (rsq package, type 'v').

\item

htmlTableWhether to use htmlTable package to display table (instead of xtable). Default is TRUE

This function creates a nice looking regression table for a glm model. Input either a glm object or outcome variable, vector of covariates, model family, and type of analysis (bivariate or multiple regression). The function returns a dataframe with regression coefficients. By default a table is also printed via htmlTable - handy for R markdown html reports. coefficients glm linear logistic poisson regression table


lisaerein/daphne documentation built on May 21, 2019, 6:42 a.m.