Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Mar 13, 2024
1 parent 15864c5 commit 8c19f0b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions R/print_md.R
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ print_md.parameters_distribution <- function(x, digits = 2, ci_brackets = c("(",

# helper -----------------------

.export_table_tt <- function(x, formatted_table, groups, caption = NULL, footer = NULL) {
.export_table_tt <- function(x, formatted_table, groups, caption = NULL, footer = NULL, outformat = "markdown") {
insight::check_if_installed("tinytable", minimum_version = "0.1.0")
row_groups <- NULL
# check if we have a list of tables
Expand Down Expand Up @@ -423,14 +423,19 @@ print_md.parameters_distribution <- function(x, digits = 2, ci_brackets = c("(",
}
g
})
names(row_groups) <- paste0("*", names(groups), "*")
# set element names
names(row_groups) <- names(groups)
if (identical(outformat, "markdown")) {
# for markdown, format italic
names(row_groups) <- paste0("*", names(row_groups), "*")
}
}
# replace NA in formatted_table by ""
formatted_table[is.na(formatted_table)] <- ""
# create base table
out <- tinytable::tt(formatted_table, notes = footer, caption = caption)
# insert sub header rows and column spans
out <- tinytable::group_tt(out, i = row_groups, j = col_groups)
out@output <- "markdown"
out@output <- outformat
out
}

0 comments on commit 8c19f0b

Please sign in to comment.