@@ -16,23 +16,33 @@ knit_print.tab_tibble <- function(x, ...) {
1616
1717# ' Print a tab_list
1818# '
19+ # ' @details
20+ # ' Individual tables are printed with the `print_tabtibble()` S3 generic
21+ # ' function.
22+ # '
23+ # '
1924# ' @param x The `tab_list` object to print
2025# ' @param ... passed to `print_fun`
2126# ' @param caption The caption for each table as a character vector
22- # ' @param print_fun A function taking arguments of `x` (one data.frame to
27+ # ' @param print_fun Override the default printing using `print_tabtibble`. If
28+ # ' provided it is a function taking arguments of `x` (one data.frame to
2329# ' print), `caption` (the caption for that data.frame), and `...`.
2430# ' @param tab_prefix,tab_suffix Any text to add before/after each figure (`NULL`
2531# ' to omit)
2632# ' @returns `x` invisibly
2733# ' @family knitters
2834# ' @export
29- knit_print.tab_list <- function (x , ... , caption , print_fun = print_tablist_pander , tab_prefix = NULL , tab_suffix = " \n\n " ) {
35+ knit_print.tab_list <- function (x , ... , caption , print_fun = NULL , tab_prefix = NULL , tab_suffix = " \n\n " ) {
3036 stopifnot(length(x ) == length(caption ))
3137 for (idx in seq_along(x )) {
3238 if (! is.null(tab_prefix )) {
3339 cat(tab_prefix )
3440 }
35- print_fun(x = x [[idx ]], caption = caption [[idx ]], ... )
41+ if (is.null(print_fun )) {
42+ print_tabtibble(x = x [[idx ]], caption = caption [[idx ]], ... )
43+ } else {
44+ print_fun(x = x [[idx ]], caption = caption [[idx ]], ... )
45+ }
3646 if (! is.null(tab_suffix )) {
3747 cat(tab_suffix )
3848 }
0 commit comments