Learn R Programming

texreg (version 1.37.5)

knitreg: Flexibly choose the right table output format for use with knitr

Description

Flexibly choose the right table output format for use with knitr.

Usage

knitreg(...)

Arguments

...

Arguments to be handed over to the texreg, htmlreg, screenreg, or matrixreg function. See the respective help page for details.

Value

A table as a character string in the respective output format.

Details

This function automatically selects the right function (texreg, screenreg, htmlreg, or matrixreg) with the right set of arguments for use with the knitr package, for example in RStudio. The advantage of using this function with knitr is that the user does not need to replace the texreg, htmlreg etc. function call in the document when a different output format is selected.

knitreg works with...

  • R HTML documents (.Rhtml extension)

  • R Sweave documents (.Rnw extension) for PDF output via LaTeX, rendered using...

    • the knitr package

    • the Sweave package

  • R Markdown documents (.Rmd extension), rendered as...

    • HTML documents

    • PDF documents

    • Word documents

    • Powerpoint presentations

    • Presentations (.Rpres extension, not .Rmd)

  • R Notebooks, including preview

If Markdown and HTML rendering are selected, htmlreg arguments doctype = FALSE and star.symbol = "\*" are set to enable compatibility with Markdown. With R HTML documents (but not Markdown) or presentations (.Rpres extension), only doctype = FALSE is set.

For PDF/LaTeX documents, the texreg argument use.packages = FALSE is set to suppress any package loading instructions in the preamble. The user must load any packages manually in the preamble of the document.

The knitr and rmarkdown packages must be installed for this function to work.

See Also

texreg-package extract

Other texreg: htmlreg(), huxtablereg(), matrixreg(), plotreg(), screenreg(), texreg, wordreg()

Examples

Run this code
# NOT RUN {
require("nlme")
model.1 <- lme(distance ~ age, data = Orthodont, random = ~ 1)
model.2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1)
knitreg(list(model.1, model.2), center = FALSE, caption = "", table = FALSE)

# }

Run the code above in your browser using DataLab