From 19547b5107ed4f65fc0dda6dbb1cabf7336738d8 Mon Sep 17 00:00:00 2001 From: kbrevoort Date: Sun, 12 Jan 2020 15:08:50 -0500 Subject: [PATCH] Fix top line before variable output Was not working when first variable was part of a packed variable group. --- R/print-tabler-objects.R | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/R/print-tabler-objects.R b/R/print-tabler-objects.R index 6a149c6..05bd6af 100644 --- a/R/print-tabler-objects.R +++ b/R/print-tabler-objects.R @@ -63,15 +63,16 @@ tabler2kable <- function(tblr_obj, format = NULL) { kableExtra::row_spec(get_last_coefficient_row(body_dt), hline_after = TRUE, extra_latex_after = '\\addlinespace[0.5em]') %>% + add_midrule(tblr_obj$theme$booktabs) %>% do_packing(pack_detail) %>% add_header_rows(header_dt) %>% - clean_errant_codes() %>% - add_midrule(tblr_obj$theme$booktabs) + clean_errant_codes() } add_midrule <- function(in_kable, booktabs) { #last_header_text <- dplyr::last(attr(in_kable, 'kable_meta')$new_header_row) - first_var <- paste0('\n', attr(in_kable, 'kable_meta')$rownames[1]) + #first_var <- paste0('\n', attr(in_kable, 'kable_meta')$rownames[1]) + first_var <- attr(in_kable, 'kable_meta')$contents[[1]] if (booktabs) { paste_string <- '\n\\\\midrule \\\\addlinespace[0.5em]'