Each theme_ltsummary_*() function builds a theme, activates it with
set_ltsummary_theme() (unless set_theme = FALSE), and returns the
element list invisibly. Clear the active theme with
reset_ltsummary_theme().
theme_ltsummary_mean_sd(): continuous variables report"{mean} ({sd})", andadd_p()defaults to"t.test"and"oneway.test"for them.theme_ltsummary_continuous2(): continuous variables default to the multi-line"continuous2"type, with the statistics of thestatisticargument.theme_ltsummary_eda(): every continuous variable gets three lines, median with quartiles, mean with standard deviation, and the range, and percentages show one decimal place.theme_ltsummary_compact(): tables render with a smaller font and less cell padding.theme_ltsummary_journal(): the reporting conventions of a journal; see below.theme_ltsummary_language(): the default labels, headers and footnotes are translated; see below.
Usage
theme_ltsummary_mean_sd(set_theme = TRUE)
theme_ltsummary_continuous2(
statistic = "{median} ({p25}, {p75})",
set_theme = TRUE
)
theme_ltsummary_eda(set_theme = TRUE)
theme_ltsummary_compact(set_theme = TRUE, font_size = NULL)
theme_ltsummary_journal(
journal = c("jama", "lancet", "nejm", "qjecon"),
set_theme = TRUE
)
theme_ltsummary_language(
language = c("de", "en", "es", "fr", "gu", "hi", "is", "ja", "kr", "mr", "nl", "no",
"pt", "se", "zh-cn", "zh-tw", "ba"),
decimal.mark = NULL,
big.mark = NULL,
iqr.sep = NULL,
ci.sep = NULL,
set_theme = TRUE
)Arguments
- set_theme
(
scalar logical)
Whether to activate the theme withset_ltsummary_theme(). Default isTRUE. WithFALSE, the element list is returned (invisibly) without side effects.- statistic
(
string)
The statistic string of continuous variables intheme_ltsummary_continuous2(). Default is"{median} ({p25}, {p75})".- font_size
(
numeric)
Font size of the compact theme in pixels. Default is 13.- journal
(
string)
One of"jama","lancet","nejm"and"qjecon".- language
(
string)
One of"de"(German),"en"(English),"es"(Spanish),"fr"(French),"gu"(Gujarati),"hi"(Hindi),"is"(Icelandic),"ja"(Japanese),"kr"(Korean),"mr"(Marathi),"nl"(Dutch),"no"(Norwegian),"pt"(Portuguese),"se"(Swedish),"zh-cn"(Chinese Simplified),"zh-tw"(Chinese Traditional) and"ba"(Bosnian).- decimal.mark, big.mark
(
string)
The marks passed to thestyle_*()formatters while the theme is active. Default isNULL, which leaves the marks unchanged.- iqr.sep, ci.sep
(
string)
Separators of the interquartile range and of confidence intervals.
Journals
"jama", JAMA: p-values with two significant digits, the quartiles of the interquartile range separated by an en dash, percentages without the%sign, statistic labels on each row with the quartile label shortened to"IQR", and the estimate oftbl_regression()andadd_difference()merged with its confidence interval into one column."nejm", New England Journal of Medicine: as JAMA, without the relocated statistic labels and merged columns."lancet", The Lancet: the interpunct as decimal mark, a space as big mark, and p-values rounded to the journal's rules."qjecon", The Quarterly Journal of Economics: percentages with one decimal place, and regression tables with the standard error under the estimate, significance stars fromadd_significance_stars()and no confidence interval column.
Languages
theme_ltsummary_language() translates the default headers, labels and
footnotes ("Characteristic", "Median", "Unknown", the test names, ...)
with the translation table of gtsummary 2.5.1. Text from your data, such
as variable labels and factor levels, is not translated. decimal.mark
and big.mark change the number formatting; iqr.sep and ci.sep
change the separators of the interquartile range in tbl_summary() and of
confidence intervals. When decimal.mark = "," is given, the separators
default to an en dash so numbers stay unambiguous.
Examples
set_ltsummary_theme(theme_ltsummary_eda(set_theme = FALSE))
#> Setting theme "Exploratory Data Analysis"
tbl_summary(trial, include = c(age, grade))
reset_ltsummary_theme()
with_ltsummary_theme(
theme_ltsummary_language("es", set_theme = FALSE),
tbl_summary(trial, by = trt, include = age)
)