Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# table1 development

* Variable labels to span all cells by default (fix #133)

# table1 1.5

* Improvements to `kableExtra` output generated by `t1kable()`.
Expand Down
2 changes: 2 additions & 0 deletions R/table1.R
Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,7 @@ t1flex <- function(x, tablefn=c("qflextable", "flextable", "regulartable"), ...)
y <- as.data.frame(y, stringsAsFactors=F)
y2 <- data.frame(x=paste0(c("", rep("\U{00A0}\U{00A0}", nrow(y) - 1)), rownames(y)), stringsAsFactors=F)
y <- cbind(setNames(y2, rlh), y)
y[1,] <- y[1,1] # Setup for labels spanning columns
y
})
df <- do.call(rbind, z)
Expand Down Expand Up @@ -1274,6 +1275,7 @@ t1flex <- function(x, tablefn=c("qflextable", "flextable", "regulartable"), ...)
out <- flextable::align(out, j=2:(ncolumns+1), align="center", part="header")
out <- flextable::bold(out, part="header")
out <- flextable::bold(out, i=i, j=1)
out <- flextable::merge_h(out, i = i) # Make labels span columns

if (!is.null(caption)) {
out <- flextable::set_caption(out, caption=caption)
Expand Down