tab_settings | R Documentation |
Define tabulation marks configuration. Specifying positions and types of tabulation marks in table paragraphs helps to organize the content, especially in clinical tables by aligning numbers properly.
tab_settings(x, i = NULL, j = NULL, value = TRUE, part = "body")
x |
a flextable object |
i |
rows selection |
j |
columns selection |
value |
an object of generated by |
part |
partname of the table (one of 'all', 'body', 'header', 'footer') |
Other sugar functions for table style:
align()
,
bg()
,
bold()
,
color()
,
empty_blanks()
,
font()
,
fontsize()
,
highlight()
,
italic()
,
keep_with_next()
,
line_spacing()
,
padding()
,
rotate()
,
valign()
library(officer)
library(flextable)
z <- data.frame(
Statistic = c("Median (Q1 ; Q3)", "Min ; Max"),
Value = c(
"\t999.99\t(99.9 ; 99.9)",
"\t9.99\t(9999.9 ; 99.9)"
)
)
ts <- fp_tabs(
fp_tab(pos = 0.4, style = "decimal"),
fp_tab(pos = 1.4, style = "decimal")
)
zz <- flextable(z) |>
tab_settings(j = 2, value = ts) |>
width(width = c(1.5, 2))
save_as_docx(zz, path = tempfile(fileext = ".docx"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.