Description Usage Arguments Details Value Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27  extract_eq(
model,
intercept = "alpha",
greek = "beta",
greek_colors = NULL,
subscript_colors = NULL,
var_colors = NULL,
var_subscript_colors = NULL,
raw_tex = FALSE,
swap_var_names = NULL,
swap_subscript_names = NULL,
ital_vars = FALSE,
label = NULL,
index_factors = FALSE,
show_distribution = FALSE,
wrap = FALSE,
terms_per_line = 4,
operator_location = "end",
align_env = "aligned",
use_coefs = FALSE,
coef_digits = 2,
fix_signs = TRUE,
font_size = NULL,
mean_separate,
return_variances = FALSE,
...
)

model 
A fitted model 
intercept 
How should the intercept be displayed? Default is 
greek 
What notation should be used for
coefficients? Currently only accepts 
greek_colors 
The colors of the greek notation in the equation. Must be a single color (named or HTML hex code) or a vector of colors (which will be recycled if smaller than the number of terms in the model). When rendering to PDF, I suggest using HTML hex codes, as not all named colors are recognized by LaTeX, but equatiomatic will internally create the color definitions for you if HTML codes are supplied. Note that this is not yet implemented for mixed effects models (lme4). 
subscript_colors 
The colors of the subscripts for the greek notation.
The argument structure is equivalent to 
var_colors 
The color of the variable names. This takes a named vector
of the form 
var_subscript_colors 
The colors of the factor subscripts for
categorical variables. The interface for this is equivalent to

raw_tex 
Logical. Is the greek code being passed to denote coefficients raw tex code? 
swap_var_names 
A vector of the form c("old_var_name" = "new name"). For example: c("bill_length_mm" = "Bill Length (MM)"). 
swap_subscript_names 
A vector of the form c("old_subscript_name" = "new name"). For example: c("f" = "Female"). 
ital_vars 
Logical, defaults to 
label 
A label for the equation, which can then be used for intext
references. See example here.
Note that this only works for PDF output. The intext references also
must match the label exactly, and must be formatted as

index_factors 
Logical, defaults to 
show_distribution 
Logical. When fitting a logistic or probit
regression, should the binomial distribution be displayed? Defaults to

wrap 
Logical, defaults to 
terms_per_line 
Integer, defaults to 4. The number of righthand side
terms to include per line. Used only when 
operator_location 
Character, one of “end” (the default) or
“start”. When terms are split across multiple lines, they are split
at mathematical operators like 
align_env 
TeX environment to wrap around equation. Must be one of

use_coefs 
Logical, defaults to 
coef_digits 
Integer, defaults to 2. The number of decimal places to round to when displaying model estimates. 
fix_signs 
Logical, defaults to 
font_size 
The font size of the equation. Defaults to default of the output format. Takes any of the standard LaTeX arguments (see here). 
mean_separate 
Currently only support for 
return_variances 
Logical. When 
... 
Additional arguments (for future development; not currently used). 
Extract the variable names from a model to produce a 'LaTeX' equation, which is output to the screen. Supports any model supported by broom::tidy.
A character of class “equation”.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52  # Simple model
mod1 < lm(mpg ~ cyl + disp, mtcars)
extract_eq(mod1)
# Include all variables
mod2 < lm(mpg ~ ., mtcars)
extract_eq(mod2)
# Works for categorical variables too, putting levels as subscripts
mod3 < lm(body_mass_g ~ bill_length_mm + species, penguins)
extract_eq(mod3)
set.seed(8675309)
d < data.frame(
cat1 = rep(letters[1:3], 100),
cat2 = rep(LETTERS[1:3], each = 100),
cont1 = rnorm(300, 100, 1),
cont2 = rnorm(300, 50, 5),
out = rnorm(300, 10, 0.5)
)
mod4 < lm(out ~ ., d)
extract_eq(mod4)
# Don't italicize terms
extract_eq(mod1, ital_vars = FALSE)
# Wrap equations in an "aligned" environment
extract_eq(mod2, wrap = TRUE)
# Wider equation wrapping
extract_eq(mod2, wrap = TRUE, terms_per_line = 4)
# Include model estimates instead of Greek letters
extract_eq(mod2, wrap = TRUE, terms_per_line = 2, use_coefs = TRUE)
# Don't fix doubledup "+ " signs
extract_eq(mod2, wrap = TRUE, terms_per_line = 4, use_coefs = TRUE, fix_signs = FALSE)
# Use indices for factors instead of subscripts
extract_eq(mod2, wrap = TRUE, terms_per_line = 4, index_factors = TRUE)
# Use other model types, like glm
set.seed(8675309)
d < data.frame(
out = sample(0:1, 100, replace = TRUE),
cat1 = rep(letters[1:3], 100),
cat2 = rep(LETTERS[1:3], each = 100),
cont1 = rnorm(300, 100, 1),
cont2 = rnorm(300, 50, 5)
)
mod5 < glm(out ~ ., data = d, family = binomial(link = "logit"))
extract_eq(mod5, wrap = TRUE)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.