From: dscott Date: Wed, 6 Jan 2016 23:34:03 +0000 (+0000) Subject: Fixed alignment of column headings in xtableList, with multiple and X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=b404eafec2b371018c1a02bcc52226f88e625749;p=xtable.git Fixed alignment of column headings in xtableList, with multiple and include.rownmes TRUE git-svn-id: svn://scm.r-forge.r-project.org/svnroot/xtable@82 edb9625f-4e0d-4859-8d74-9fd3b1da38cb --- diff --git a/pkg/R/xtableList.R b/pkg/R/xtableList.R index 35736f0..f0fb6d6 100644 --- a/pkg/R/xtableList.R +++ b/pkg/R/xtableList.R @@ -105,6 +105,7 @@ print.xtableList <- function(x, include.colnames <- TRUE } + ## Create headings for columns if multiple headings are needed if (colnames.format == "multiple"){ if (is.null(sanitize.colnames.function)) { colHead <- names(x[[1]]) @@ -115,6 +116,9 @@ print.xtableList <- function(x, colHead <- paste("\\begin{sideways}", colHead, "\\end{sideways}") } colHead <- paste0(colHead, collapse = " & ") + if (include.rownames) { + colHead <- paste0(" & ", colHead) + } colHead <- paste0(tRule, "\n", colHead, " \\\\", mRule, "\n") add.to.row <- list(pos = NULL, command = NULL) add.to.row$pos <- as.list(c(0, c(combinedRowNums[1:length(x)])))