Allow no colnames with PDF output when booktabs enabled
diff --git a/R/group_rows.R b/R/group_rows.R
index 85962cf..d3871f7 100644
--- a/R/group_rows.R
+++ b/R/group_rows.R
@@ -162,8 +162,12 @@
}
if (italic) group_label <- paste0("\\\\textit{", group_label, "}")
# Add group label
- rowtext <- table_info$contents[start_row + 1]
if (table_info$booktabs) {
+ if (is.null(table_info$colnames)) {
+ rowtext <- table_info$contents[start_row]
+ } else {
+ rowtext <- table_info$contents[start_row + 1]
+ }
pre_rowtext <- paste0(
"\\\\addlinespace[", gap_space, "]\n",
ifelse(hline_before,"\\\\hline\n", ""),
@@ -174,6 +178,7 @@
"}\\\\\\\\\n", ifelse(hline_after, "\\\\hline\n", '')
)
} else {
+ rowtext <- table_info$contents[start_row + 1]
rowtext <- paste0("\\\\hline\n", rowtext)
pre_rowtext <- paste0(
"\\\\hline\n\\\\multicolumn{", table_info$ncol, "}{", latex_align,"}{",