WAACHS table formatting function.
waachs_table.Rd
Function to apply consistent formatting to summary tables rendered using R. Works with functions from the gtsummary
package, or dataframes.
Usage
waachs_table(
x,
font.size = 10,
font.size.header = 11,
line.spacing = 1.5,
padding = 2.5,
body_bg_col = "#FEF0D8",
header_bg_col = "#89A1AD",
header_text_col = "black",
highlight = NULL,
highlight_darken = 0.3,
font_family = "Barlow",
...
)
Arguments
- x
A table, typically a data.frame, tibble, or output from gtsummary.
- font.size
The font size for text in the body of the table, defaults to 8 (passed throught to set_flextable_defaults).
- font.size.header
The font size for text in the header of the table, defaults to 10.
- line.spacing
Line spacing for the table, defaults to 1.5 (passed throught to set_flextable_defaults).
- padding
Padding around all four sides of the text within the cell, defaults to 2 (passed throught to set_flextable_defaults).
- body_bg_col
Body background colour (default WAACHS cream).
- header_bg_col
Header background colour (default WAACHS blue).
- header_text_col
Header text colour (default black).
- highlight
A numeric vector specifying rows to highlight.
- highlight_darken
A numeric value specifying the amount by which
body_bg_col
should be "darkened" (tinted) (default 0.3).- font_family
Font family for plot (default Barlow).
- ...
Other arguments parsed to
flextable::set_flextable_defaults
.
Examples
head(mtcars) %>%
waachs_table()
mpg
cyl
disp
hp
drat
wt
qsec
vs
am
gear
carb
21.0
6
160
110
3.90
2.620
16.46
0
1
4
4
21.0
6
160
110
3.90
2.875
17.02
0
1
4
4
22.8
4
108
93
3.85
2.320
18.61
1
1
4
1
21.4
6
258
110
3.08
3.215
19.44
1
0
3
1
18.7
8
360
175
3.15
3.440
17.02
0
0
3
2
18.1
6
225
105
2.76
3.460
20.22
1
0
3
1