inline_reg | R Documentation |

`inline_reg`

presents the fit of a coefficient from a `lm`

or `glm`

model in LaTeX format to be reported inline in an RMarkdown document.

```
inline_reg(model, fit = TRUE, stat = TRUE, pval = TRUE, digits = 2)
inline_reg_p(model, digits = 2)
inline_anova(model, stat = TRUE, pval = TRUE, digits = 2)
```

`model` |
A regression model |

`fit` |
Logical, whether the regression fit is to be reported (default TRUE, only applicable to |

`stat` |
Logical, whether the test statistic for the coefficient should be reported (default TRUE) |

`pval` |
Logical, whether the p-value for the coefficient should be reported (default TRUE) |

`digits` |
Number of digits to round to (default to 2) |

For `lm`

objects, results include R-squared, the F statistic, and the p-value. For `glm`

objects, results include the chi-squared statistic and the p-value.

This function currently only supports `lm`

and `glm`

objects. Suggestions and requests are welcomed.

`inline_reg_p`

is a wrapper for `inline_reg`

to report only the p-value (sets all non-p-value logicals to FALSE). `inline_anova`

is a wrapper to report a one-way ANOVA result in which `fit`

is set to FALSE and other logical inputs (`stat`

, `pval`

, and `digits`

) are allowed to be user-defined.

Returns a LaTeX-formatted result for use in RMarkdown document.

```
x1 = rnorm(20)
y1 = x1 + rnorm(20)
model1 = lm(y1 ~ x1)
inline_reg(model1)
x2 = rnorm(20)
y2 = rbinom(n=20, size=1, prob=pnorm(x2))
model2 = glm(y2 ~ x2, family=binomial('logit'))
inline_reg(model2)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.