huxtable (version 0.2.2)

huxreg: Create a huxtable to display model output

Description

Create a huxtable to display model output

Usage

huxreg(..., error_style = c("stderr", "ci", "statistic", "pvalue"),
  error_pos = c("below", "same", "right"), number_format = "%.3f",
  pad_decimal = ".", ci_level = 0.95, stars = c(`***` = 0.001, `**` =
  0.01, `*` = 0.05), bold_signif = NULL, note = "%stars%.",
  statistics = c(N = "nobs", R2 = "r.squared", "logLik", "AIC"),
  coefs = NULL, omit_coefs = NULL)

Arguments

...
Models, or a single list of models.
error_style
How to display uncertainty in estimates. One or more of 'stderr', 'ci' (confidence interval), 'statistic' or 'pvalue'.
error_pos
Display uncertainty 'below', to the 'right' of, or in the 'same' cell as estimates.
number_format
Format for numbering. See number_format for details.
pad_decimal
Character for decimal point; columns will be right-padded to align these. Set to NA to turn off padding. See pad_decimal for details.
ci_level
Confidence level for intervals.
stars
Levels for p value stars. Names of stars are symbols to use.
bold_signif
Where p values are below this number, cells will be displayed in bold. Use NULL to turn off this behaviour.
note
Footnote for bottom cell, which spans all columns. %stars% will be replaced by a note about significance stars. Set to NULL for no footnote.
statistics
Summary statistics to display.
coefs
Display only these coefficients. Overrules omit_coef.
omit_coefs
Omit these coefficients.

Value

A huxtable object.

Details

Models must have a tidy method defined, which should return 'term', 'estimate', 'std.error', 'statistic' and 'p.value'. If the tidy method does not have a conf.int option, huxreg will calculate confidence intervals itself, using a normal approximation.

If ... is a named list, the names will be used for column headings. If the coef and/or statistics vectors have names, these will be used for row headings. If different values of coef have the same name, the corresponding rows will be merged in the output.

Each element of statistics should be a column name from glance. You can also use 'nobs' for the number of observations.

Examples

Run this code
set.seed(27101975)
dfr <- data.frame(a = rnorm(100), b = rnorm(100))
dfr$y <- dfr$a + rnorm(100)
lm1 <- lm(y ~ a, dfr)
lm2 <- lm(y ~ a + b, dfr)
glm1 <- glm(I(y > 0) ~ a, dfr, family = binomial)
huxreg(lm1, lm2, glm1)

Run the code above in your browser using DataCamp Workspace