| knit_print.data.frame {huxtable} | R Documentation |
Print data frames in knitr using huxtable
## S3 method for class 'data.frame' knit_print(x, options, ...)
x |
A huxtable. |
options |
Not used. |
... |
Not used. |
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.
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.
Other knit_print: knit_print.huxtable
## 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)
data.frame(a = 1:5, b = 1:5) # groovy!
## End(Not run)