Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

knit_print.data.frame

Print data frames in knitr using huxtable


Description

Print data frames in knitr using huxtable

Usage

knit_print.data.frame(x, options, ...)

Arguments

x

A huxtable.

options

Not used.

...

Not used.

Details

huxtable defines a knit_print method for data.frames. This converts the data frame to a huxtable, with add_colnames = TRUE, themes it using theme_plain() and prints it. It also tries to set a few intelligent defaults, e.g. wrapping long columns and setting an appropriate width. To turn this behaviour off, set options(huxtable.knit_print_df = FALSE). To change the theme, set options("huxtable.knit_print_df_theme") to a one-argument function which should return the huxtable.

See Also

Other knit_print: knit_print.huxtable()

Examples

## Not run: 
# in your knitr document
mytheme <- function (ht) {
  ht <- set_all_borders(ht, 0.4)
  ht <- set_all_border_colors(ht,
        "darkgreen")
  ht <- set_background_color(ht,
        evens, odds, "salmon")
  ht
}

options(huxtable.knit_print_df_theme
      = mytheme)
# groovy!
data.frame(
        a = 1:5,
        b = 1:5
      )

## End(Not run)

huxtable

Easily Create and Style Tables for LaTeX, HTML and Other Formats

v5.3.0
MIT + file LICENSE
Authors
David Hugh-Jones [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.