A style is a small set of number-formatting rules – how many
decimals a p-value gets, where it bottoms out, whether it keeps its
leading zero, what the decimal mark is, how a confidence interval is
written – with the word that opens the note under the table and the
abbreviations that note defines.
spicy_style() composes one by hand; the named themes
("jama", "nejm", "lancet", "annals", "apa", "aer" –
spicy_style_names() returns the list) are pre-composed ones, each
encoding rules taken verbatim from an official document of the
institution.
Usage
spicy_style(
base = NULL,
...,
p_style = NULL,
p_digits = NULL,
p_floor = NULL,
p_bands = NULL,
p_sigfig = NULL,
decimal_mark = NULL,
ci_sep = NULL,
ci_brackets = NULL,
stars = NULL,
digits = NULL,
effect_size_digits = NULL,
fit_digits = NULL,
ic_digits = NULL,
percent_digits = NULL,
note_label = NULL,
abbreviations = NULL,
sample_size = NULL,
minus_sign = NULL,
big_mark = NULL,
v_digits
)
spicy_style_names()Arguments
- base
Optional theme to start from – a theme name or another
spicy_style– whose levers the arguments below override. This is the composition escape hatch:spicy_style("lancet", ci_sep = " to ")is The Lancet's rules with one of them changed. The theme's provenance travels with the result and names the levers you overrode, so a modified theme never passes for the theme itself.- ...
Must be empty. Any argument landing here is a misspelled lever and raises an error rather than being ignored.
- p_style
How p-values carry their leading zero:
"apa"drops it (.003),"standard"keeps it (0.003).NULLleaves spicy's default, which follows the mark: dropped under a point, kept under a comma.- p_digits
Decimal places for p-values (a positive integer). Under
p_sigfigit acts as the decimal cap instead.- p_floor
The value below which a p-value prints as
<floorrather than exactly, e.g.0.001for<.001. A number strictly between 0 and 1.NULLuses10^-p_digits.- p_bands
Decimal places that vary with the size of the p-value: a list of two-element numeric vectors
c(cutoff, digits), cutoffs strictly increasing, the last oneInf.list(c(0.01, 3), c(Inf, 2))reads as "three decimals below .01, two otherwise". The comparison isp < cutoff. Mutually exclusive withp_sigfig.- p_sigfig
Significant figures for p-values (a positive integer), capped at
p_digitsdecimal places. Mutually exclusive withp_bands.- decimal_mark
A single character; the mark between the integer and the decimal part of every number in the table.
- ci_sep
The string between the two bounds of a confidence interval.
NULLkeeps spicy's default, which is", "and turns into"; "when the decimal mark is a comma.- ci_brackets
A character vector of length two, the opening and closing delimiters of a confidence interval, e.g.
c("[", "]")orc("(", ")").- stars
Significance stars:
FALSEto suppress them, or a named numeric vector of symbol-to-threshold pairs such asc("***" = .001, "**" = .01, "*" = .05).- digits, effect_size_digits, fit_digits, ic_digits
Decimal places for estimates, effect sizes, fit statistics and information criteria. Each is applied only by the table functions that have the matching argument:
effect_size_digitsreaches the association measure and the SMD oftable_categorical()too.- percent_digits
Decimal places for percentages.
- note_label
The word that opens the note under the table, set in italics in every rendered output:
"Note."(the default, APA Manual 7 section 7.14),"Note:"(Chicago Manual of Style 18, paragraphs 3.77-3.81), or""for no lead-in word (AMA Manual of Style 11, section 4.1.4.10). The language spells it: underoptions(spicy.language = "fr"),"Note:"is written "Note :", with the no-break space French puts before a colon, in every output. Anoteyou type is printed as typed after it, unless it opens with a lead-in of its own, set in italics when it is the lead-in in force.- abbreviations
Which abbreviations the note under the table defines: those of its headers, its spanners and the labels of its stub (the fit statistics and the random effects of a regression), not the symbols inside its cells. A definition identifies the quantity by its standard name, in one expression, the author included when the name carries one (g = Hedges's g); it never explains what the quantity measures or how to read it, which belongs to the text.
NULL(the default) follows the rule of the theme in force, the APA rule when there is none (see Themes)."all"defines every abbreviation and symbol the table shows, abbreviated words such as Min and Max included, except n, N, p and the test statistics (t, z, F, \(\chi^2\)), which no style and no journal defines: the setting for readers outside the field."none"defines none, but keeps the disambiguations, the definitions without which the symbol is ambiguous (partial eta squared, the IQR as the width Q3 - Q1, the method of a standardized \(\beta\), the design-based standard error). Either way the definitions take the form and the place of the theme in force. Anoteyou type is printed as typed.- sample_size
Where the tables give their sample size, the number of rows they describe.
"note"(the default) opens the note with it: "N = 1200." and, underby, the n of each group, "N = 1200: Female (n = 620), Male (n = 580)."."header"heads each group column with its n instead, "Female (n = 620)", the Total column with N and the column of missingbyvalues with its own n, in the tables whose groups are columns (table_categorical(),table_categorical_svy()andtable_continuous_lm()), in every output; the note then keeps "N = 1200." alone, and the note oftable_categorical_svy()keeps its own sentence. The n are the unweighted counts the note gives, for a survey design too. Withoutby, and intable_continuous()andtable_outcome(), whose groups are rows,"header"is"note"."none"leaves the sentence out of the note of every table that writes one, the survey tables included; the Base row oftable_multiresponse()stays. The data frames,tidy()andglance()do not change. The"jama"and"lancet"themes set"header";spicy_style("jama", sample_size = "note")restores the note.- minus_sign
The sign of a negative number in the outputs that are printed:
output = "flextable"and"word"(a flextable knitted into Word too),output = "gt"in HTML, Word, RTF and LaTeX, the HTML, Typst and LaTeX ofoutput = "tinytable"(and its markdown inside a knit to Word), and the PDF ofcode_book(), which reads the lever fromoptions(spicy.style)."typographic"(the default) sets the minus sign (Unicode U+2212, as wide as the plus sign) in place of the hyphen-minus,"ascii"keeps the hyphen-minus. It applies to the cells of the statistics (estimates, intervals, differences, effect sizes, thresholds, the summaries of a codebook) and to the numbers of a table's note (a hyphen before a digit, after a space,=,(,[,,or;: a date orN-1keep theirs), not to the labels, the codes of a codebook or the headers. LaTeX sets the sign in math mode, which every engine and font has. The outputs whose text is copied or read back keep the hyphen-minus – the data frame, the console,output = "excel","clipboard", markdown and the long output: a spreadsheet or a parser reads a minus sign as text, not as part of a number. A printed table pasted into a spreadsheet therefore gives text; build it withminus_sign = "ascii"for that use. No theme sets it.tinytable::save_tt(x, "table.docx")writes the table through markdown and keeps the hyphen-minus: for a Word file, useoutput = "word"(or"flextable"), or knit the table in a Word document.- big_mark
The thousands separator of the counts.
NULL(the default) writes none: "7846". A single character groups the digits of the integer part by three:","for APA ("7,846"),"\u202f"for the narrow no-break space of French typography and of the SI ("7 846"),"'"for Swiss usage ("7'846"). It applies to the counts of every table that takes a style: n, N, weighted counts, the cells of a cross-tabulation, numbers of events and of groups, and the counts of the notes and headers ("N = 7,846"). Never to degrees of freedom, years, estimates, percentages or fit statistics that are not counts (AIC, deviance). A column that aligns its numbers on the decimal mark stays aligned. It cannot be a digit, the decimal mark or a minus sign.freq()andcross_tab(), which take nostyle, read it fromoptions(spicy.style). No language sets it: underoptions(spicy.language = "fr"), ask forbig_mark = "\u202f". The data frames,tidy()andglance()keep their numbers; only cells already written as text take the separator.output = "excel"keeps a count as a number and groups it through the cell's number format (#,##0): Excel then shows the separator of its own locale, not the character given here.- v_digits
Defunct. Renamed
effect_size_digitsin spicy 0.14.0; supplyingv_digitsis an error (classspicy_defunct).
Value
spicy_style() returns an object of class spicy_style: a
named list holding only the levers that were set. Themes returned
by name carry a provenance attribute with the journal, its
source document and the exact list of encoded rules; print()
shows it. spicy_style_names() returns the character vector of
available theme names.
Details
A style is accepted by the style argument of the nine table
functions (table_categorical(), table_categorical_svy(),
table_continuous(), table_continuous_svy(),
table_continuous_lm(), table_outcome(), table_multiresponse(),
table_regression() and table_regression_uv()), either as a theme
name or as the object returned here, and by
options(spicy.style = ) for document-wide scope.
What a theme claims, and what it does not
A theme covers numeric formatting conformity, the word that opens the table note, the abbreviations that note defines, where the sample size goes and, in English, how the mean and the median are headed, only – not full editorial conformity. It does not check reporting guidelines, table structure, footnote symbols, units, or anything else a journal's instructions ask of a manuscript. Each theme below lists the exact rules it encodes, with the sentence it encodes them from; anything not listed is spicy's own default, not the journal's rule.
Themes only move defaults. An argument you type wins over the
theme, always: table_regression(fit, style = "lancet", digits = 3)
is a Lancet table with three decimals. One consequence worth
stating: typing p_digits is a request for that many decimals on
every p-value, so it also switches off the theme's own ways of
choosing p-precision – p_bands, p_sigfig, and the p_floor
derived from them. The leading-zero rule is orthogonal and stays.
Resolution order
An argument you type, then the style argument, then
getOption("spicy.style"), then the typography of
getOption("spicy.language"), then spicy's defaults. Within a
style, an explicit function argument beats the style's value for
the same lever.
The language's locale
A language brings its typography with it, at the bottom of that
order. options(spicy.language = "fr") is therefore one gesture
for a coherent French report table – French words, and numbers
written the French way: comma decimal mark, and the leading zero
French typography keeps on a p-value (0,003). "La virgule est
utilisée pour séparer les unités des décimales" (European Union,
Code de rédaction interinstitutionnel, French edition 2022,
point 6.5, p. 110, https://style-guide.europa.eu/fr); "Si le nombre
se situe entre +1 et -1, le séparateur décimal est toujours précédé
d'un zéro" (BIPM, Le Système international d'unités, 9th
edition, 2019, section 5.4.4, p. 38,
https://www.bipm.org/documents/20126/41483022/SI-Brochure-9.pdf).
"en" brings no locale, and nothing changes for anyone who sets
no language. The locale reaches the exploration pair as well:
freq() and cross_tab() have no style layer, so the language
sets the DEFAULT of their decimal_mark and nothing else. An
argument you type still wins. The leading zero of a p-value works
the same way in both worlds: its DEFAULT follows the mark – a
comma keeps it (0,003), a point drops it (.003) – and
p_style is the explicit lever that overrides that default
wherever there is one, which is why a theme's rule survives any
mark in the table_*() families while the pair, having no such
lever, always follows its mark.
A theme composes with a locale rather than fighting it, because a
theme encodes only what its own source states: "jama" fixes no
decimal mark, so JAMA under a French language gives JAMA's p-value
rules and the French comma. Where the two do meet, the theme wins –
you asked for it by name. "lancet" keeps its midline decimal
point; "apa" keeps its missing leading zero, which under a comma
prints ,003, a form the SI brochure forbids. That is the price of
an explicit gesture; to keep APA's other rules and restore the
zero, compose the way out yourself:
style = spicy_style("apa", p_style = "standard"). One lever bends
the other way: a theme's ", " interval separator was sourced
under a dot mark, and under a comma mark it would BE the mark – so
it yields to the derived "; ", exactly as the French adaptations
of APA style themselves write ([3,45; 6,78]). Any other
separator (" to ", an en dash) is unambiguous and stays.
An argument beats both, which is the escape hatch for a bilingual
table: decimal_mark = "." under a French language gives French
words and a decimal point. It moves only the mark: the p-value
keeps the locale's leading zero (0.003), because p_style is a
style lever with no argument of its own –
style = spicy_style(p_style = "apa") drops it again.
See spicy_labels() for the language option itself.
Themes
"jama" – JAMA / JAMA Network
Source: Instructions for Table Creation, JAMA Network author
document, undated (PDF file created 23 February 2016)
(https://jamanetwork.com/DocumentLibrary/InstructionsForAuthors/InstructionsForTableCreation.pdf),
consulted 2026-08-14.
Encoded:
p-values on two decimals, three below
.01, floored at<.001, with no leading zero – "All P values should be reported to exact numbers to 2 digits past the decimal point, regardless of statistical significance. For values lower than .01, present the P value to 3 digits. Express any values lower than .001 as P<.001."no lead-in word before the note under the table (
note_label = "") – the AMA Manual of Style, 11th edition (2020), section 4.1.4.10, gives table footnotes none: a footnote on the whole table is called by a letter "placed after the table title".the abbreviations of the note on its first line,
Abbreviations: HR, hazard ratio; OR, odds ratio., in alphabetical order,Abbreviation:for one – section 4.1.4.10 again: that footnote comes first, "set off with an introductory word or phrase instead of a letter", and "abbreviations are expanded in alphabetical order". SD, SE and CI are not expanded (section 13.11, "no need to expand"), nor are the symbols of section 19.6 that do not carry "expand at first mention" (n, N, P, d, \(R^2\), \(\Delta\), \(\sigma\), \(\rho\)), B and M among them, which that section writes b and \(\bar{x}\): it lists them as usable "without expansion except where noted".the mean and the median headed
MeanandMedian, notMandMdn– section 4.1.5 writes "mean (SD)" and "median (IQR)" in full.the n of each group in its column header (
sample_size = "header"), as the model Table 1 of the document heads its groups: "Intervention (n=200)", "Control (n=201)". spicy writes "(n = 200)", with its own spaces.
Not encoded: everything else in that document (percentages carrying their numerator and denominator, one datum per cell, footnote letters, SI conversion factors) is table construction, not number formatting. The document states no rule for the confidence-interval separator or the decimal mark, so spicy's defaults apply.
"nejm" – The New England Journal of Medicine
Source: NEJM Author Center, New Manuscripts, section Statistical
Reporting Guidelines
(https://www.nejm.org/author-center/new-manuscripts), a living
page; its full text was read in a browser by the package maintainer
on 2026-08-14 – the site refuses automated retrieval, which is why
earlier surveys reported these rules as unavailable.
Encoded:
tiered p-values, leading zero kept – the guidelines ask for two decimal places above 0.01, three between 0.01 and 0.001, and P<0.001 below. The guideline's own text writes
0.01/0.001: unlike JAMA, the leading zero stays.measures of association on two decimals – the guidelines ask for two decimal places for measures of association such as odds ratios (a pin of spicy's default).
Not encoded: the guideline's stated exceptions to the p rule
(stopping-rule tests, genomewide studies) are analysis contexts the
style layer cannot see; its inference policy (no p-values without a
prespecified multiplicity plan, estimates + 95% CI instead, no
p-values in the Table 1 of a randomized trial) is about what to
report, not how to format it – request those layouts through
show_columns and p_value = FALSE where you need them. No rule on
the abbreviations of a table note was found, so the note defines them
as spicy's default does.
"lancet" – The Lancet
Sources: Information for Authors, April 2026; Randomised trials
in The Lancet: formatting guidelines and Observational studies in
The Lancet: formatting guidelines, both last updated July 2025
(https://www.thelancet.com/pb-assets/Lancet/authors/tl-info-for-authors-1690986041530.pdf),
consulted 2026-08-14.
Below, the journal's midline decimal point (Unicode U+00B7, MIDDLE
DOT) is written [.] so it cannot be confused with an ordinary
period.
Encoded:
midline decimal mark, U+00B7, on every number in the table – "Type decimal points midline (ie, 23
[.]4, not 23.4)."p-values on two significant figures, capped at four decimals, floored at
p<0[.]0001, leading zero kept – the two formatting guidelines, p. 4 of each: "Supply p values to two significant figures (capped at four decimal places), or p<0[.]0001."en dash between the bounds of a confidence interval. This one is not a written rule: the journal states none. It matches the intervals printed throughout the journal's own model tables and figures (
0[.]78 (0[.]60-1[.]00)) and is encoded as conformity to the journal's published examples, nothing stronger.no lead-in word before the note under the table (
note_label = ""). Not a written rule either: the model tables of the two formatting guidelines open their note on "Data are n (%)", and none of the 38 table notes of 15 research articles published in 2025-2026, checked on 2026-10-20, opens with "Note".the abbreviations spelled out at the end of the note, one
HR=hazard ratio.sentence each, in alphabetical order, with n, N, p, SD, SE, IQR and CI left undefined. The artwork guidelines ask authors to "list and spell out all abbreviations in the table"; the form and the exemptions are not a written rule: they are those of the model tables of the two formatting guidelines ("Data are n (%), median (IQR), mean (SD) ... BMI=body-mass index.") and of 35 tables of 13 research articles published in 2025-2026, checked on 2026-10-20.the mean and the median headed
MeanandMedian, notMandMdn, as the "median (IQR), mean (SD)" of the same model tables (not a written rule).the n of each group in its column header (
sample_size = "header"), as the same model tables head their groups, "Drug A (n=500)" (not a written rule). spicy writes "(n = 500)", with its own spaces.
Not encoded: the empty-cell filler, the ban on p-values in a randomized trial's baseline table, and the absolute-rather-than- relative effect rule are content decisions, not number formats.
One caveat on the en dash. The journal's examples are ratio
measures, whose bounds are positive. On the identity scale a
negative lower bound puts a minus sign next to the dash
([-5.17--2.58]), which reads badly. The journal states no rule
for that case and none is invented here; override the separator
when it arises:
spicy_style("lancet", ci_sep = " to ").
"annals" – Annals of Internal Medicine
Source: Information for Authors, American College of Physicians,
document publication date 08/04/2026
(https://www.acpjournals.org/pb-assets/pdf/AnnalsAuthorInfo-1755188286957.pdf),
consulted 2026-08-14.
Encoded:
p-values on three decimals up to 0.20 and two decimals above it, floored at
P<0.001, leading zero kept – "For P values between 0.001 and 0.20, please report the value to the nearest thousandth. For P values greater than 0.20, please report the value to the nearest hundredth. For P values less than 0.001, report as 'P<0.001.'"
Not encoded: the percentage rule ("Report percentages to one decimal
place ... when sample size is \(\ge\) 200", no decimals below
200) is conditional on a per-group sample size that the style layer
does not see; set percent_digits yourself. The mean (SD)
notation the journal asks for, and its refusal of \(\pm\),
are already how spicy renders dispersion. No rule on the
abbreviations of a table note was found, so the note defines them as
spicy's default does.
"apa" – APA Style, 7th edition
Sources: APA Style numbers and statistics guide, last updated
11 September 2024
(https://apastyle.apa.org/instructional-aids/numbers-statistics-guide.pdf);
Sample tables, last updated June 2024
(https://apastyle.apa.org/style-grammar-guidelines/tables-figures/sample-tables),
both consulted 2026-08-14.
Encoded – and this theme pins rather than changes: spicy's
defaults already follow the guide, so style = "apa" is a promise
that a future change of those defaults will not move an
APA-formatted table.
p-values on three decimals, floored at
<.001, no leading zero – "Report exact p values to two or three decimals (e.g., p = .006, p = .03)", "report p values less than .001 as 'p < .001.'", and "Do not use a zero before a decimal when the statistic cannot be greater than 1 (proportion, correlation, level of statistical significance)."estimates and dispersion on two decimals – "Report other means and standard deviations and correlations, proportions, and inferential statistics (t, F, chi-square) to two decimals."
confidence intervals in square brackets, bounds separated by a comma – the Publication Manual, 7th edition (2020), Table 7.16 (p. 219), prints them
[LL, UL]in a single column, the alternative the Sample tables page names to its separateLLandULcolumns.the note under the table opens with "Note." in italics (
note_label = "Note.") – the Publication Manual, 7th edition (2020), section 7.14: the general note is "designated by the word 'Note' (italicized) followed by a period".the abbreviations defined at the end of the general note,
CI = confidence interval; LL = lower limit, in the order they appear in the table – sections 7.14 and 7.15 ("define the abbreviations in the order that they appear in the table"); AIC and BIC are among those section 6.44 names. The symbols that represent statistics are left undefined ("Do not define symbols or abbreviations that represent statistics (e.g., M, SD, F, t, df, p, N, n, OR, r)", section 6.44; section 7.15 adds SE), and spicy counts Mdn (the median of Table 6.5) and Hedges's g among them. So are the symbols composed of Greek letters (the same two sections) and those its sample tables leave undefined (B, \(\beta\), \(R^2\), \(\Delta R^2\), Cohen's d). This is also spicy's default rule, the one"nejm","annals"and"aer"apply.
Not encoded: the one-decimal rule for means of integer scales
(depends on what the variable measures, which spicy cannot know),
and the thousands separator, which no theme sets: add
big_mark = "," (spicy_style("apa", big_mark = ",")). Nor the star
thresholds. The official correlation and ANOVA sample tables mark
.05 / .01 / .001, which is what stars = TRUE gives you –
but as spicy's own default, not as anything this theme pins: one
stars lever carries both the thresholds and the decision to show
them, and the APA regression sample table shows none. So the theme
sets no stars, and style = "apa" never switches them on.
"aer" – American Economic Review / AEA journals
Source: AER Style Guide, American Economic Association
(https://www.aeaweb.org/journals/aer/style-guide), consulted
2026-08-14. The Tables section is shared with AEJ: Applied, AEJ:
Macro, AEJ: Policy, JEL and AEA P&P.
Encoded:
leading zero on every decimal fraction, p-values included – "Place a zero in front of the decimal point in all decimal fractions (e.g., 0.357, not .357)."
no significance stars, pinned – "Do not use asterisks to denote significance of estimation results. Report the standard errors in parentheses." This is the only outright written ban on stars in the whole surveyed corpus, so it is encoded even though spicy already defaults to
stars = FALSE. Ask forshow_columns = c("b", "se")for the standard-error layout.
Not encoded: the guide fixes no number of decimals, no p-value floor, no interval format and no decimal mark, so spicy's defaults apply. Horizontal-rules-only, no shading, a nine-column maximum and "Panel A / Panel B" blocks are layout, not number formatting. No rule on the abbreviations of a table note was found, so the note defines them as spicy's default does.
Known gaps
A rule the sources state but this release does not encode:
significant-figure rounding of estimates (Epidemiology's
nn/n.n/0.nn, Science's "report only significant digits"). spicy'sdigitsis a decimals contract applied per column family; a blanket significant-figure mode would also round fit statistics, which those rules do not ask for.
Journals deliberately absent: BMJ (its house-style page could not be read from any official source, and the widely repeated "95% CI 1.2 to 3.4" rule traces to no BMJ document), Econometrica (verified negative: the official guidelines contain no numeric table rule), QJE (its instructions page could not be read), Epidemiology (see Known gaps). Naming any of them would mean inventing their rules.
References
American Medical Association. (2020). AMA Manual of Style: A Guide for Authors and Editors (11th ed.). Oxford University Press. doi:10.1093/jama/9780190246556.001.0001
American Psychological Association. (2020). Publication manual of the American Psychological Association (7th ed.). doi:10.1037/0000165-000
University of Chicago Press. (2024). The Chicago Manual of Style (18th ed.). University of Chicago Press.
Examples
fit <- lm(mpg ~ wt + hp, data = mtcars)
# A named theme.
table_regression(fit, style = "jama")
#> Linear regression: mpg
#>
#> Variable │ B SE 95% CI p
#> ─────────────┼────────────────────────────────────
#> (Intercept) │ 37.23 1.60 [33.96, 40.50] <.001
#> wt │ -3.88 0.63 [-5.17, -2.58] <.001
#> hp │ -0.03 0.01 [-0.05, -0.01] .001
#> ╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
#> n │ 32
#> R² │ 0.83
#> Adj. R² │ 0.81
#>
#> Linear regression. Std. errors: classical (OLS).
# An argument you type beats the theme.
table_regression(fit, style = "jama", p_digits = 4)
#> Linear regression: mpg
#>
#> Variable │ B SE 95% CI p
#> ─────────────┼─────────────────────────────────────
#> (Intercept) │ 37.23 1.60 [33.96, 40.50] <.0001
#> wt │ -3.88 0.63 [-5.17, -2.58] <.0001
#> hp │ -0.03 0.01 [-0.05, -0.01] .0015
#> ╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
#> n │ 32
#> R² │ 0.83
#> Adj. R² │ 0.81
#>
#> Linear regression. Std. errors: classical (OLS).
# A style composed by hand.
table_regression(fit, style = spicy_style(decimal_mark = ",",
p_style = "standard"))
#> Linear regression: mpg
#>
#> Variable │ B SE 95% CI p
#> ─────────────┼─────────────────────────────────────
#> (Intercept) │ 37,23 1,60 [33,96; 40,50] <0,001
#> wt │ -3,88 0,63 [-5,17; -2,58] <0,001
#> hp │ -0,03 0,01 [-0,05; -0,01] 0,001
#> ╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
#> n │ 32
#> R² │ 0,83
#> Adj. R² │ 0,81
#>
#> Note. Linear regression. Std. errors: classical (OLS). CI = confidence interval.
# A theme with one rule changed.
table_regression(fit, style = spicy_style("lancet", ci_sep = " to "))
#> Linear regression: mpg
#>
#> Variable │ B SE 95% CI p
#> ─────────────┼────────────────────────────────────────
#> (Intercept) │ 37·23 1·60 [33·96 to 40·50] <0·0001
#> wt │ -3·88 0·63 [-5·17 to -2·58] <0·0001
#> hp │ -0·03 0·01 [-0·05 to -0·01] 0·0015
#> ╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
#> n │ 32
#> R² │ 0·83
#> Adj. R² │ 0·81
#>
#> Linear regression. Std. errors: classical (OLS). Adj. R²=adjusted coefficient of determination. B=unstandardized regression coefficient. R²=coefficient of determination.
# Document-wide scope.
old <- options(spicy.style = "apa")
table_continuous(mtcars, c(mpg, wt))
#> Descriptive statistics
#>
#> 95% CI
#> ────────────────
#> Variable │ M SD Min Max LL UL n
#> ────────────┼───────────────────────────────────────────────────────────
#> mpg │ 20.09 6.03 10.40 33.90 17.92 22.26 32
#> wt │ 3.22 0.98 1.51 5.42 2.86 3.57 32
#>
#> Note. N = 32. CI = confidence interval; LL = lower limit; UL = upper limit.
options(old)
# A thousands separator for the counts: "," in English,
# the narrow no-break space (U+202F) in French.
df <- data.frame(g = rep(c("a", "b"), c(1500, 2600)))
table_categorical(df, g, style = spicy_style(big_mark = ","))
#> Categorical table
#>
#> Variable │ n %
#> ────────────┼─────────────────
#> g │
#> a │ 1,500 36.6
#> b │ 2,600 63.4
#>
#> Note. N = 4,100.
# Every abbreviation defined, for readers outside the field.
table_continuous(mtcars, c(mpg, wt),
style = spicy_style(abbreviations = "all"))
#> Descriptive statistics
#>
#> 95% CI
#> ────────────────
#> Variable │ M SD Min Max LL UL n
#> ────────────┼───────────────────────────────────────────────────────────
#> mpg │ 20.09 6.03 10.40 33.90 17.92 22.26 32
#> wt │ 3.22 0.98 1.51 5.42 2.86 3.57 32
#>
#> Note. N = 32. M = mean; SD = standard deviation; Min = minimum; Max = maximum; CI = confidence interval; LL = lower limit; UL = upper limit.
# What a theme encodes, and where it comes from.
spicy_style("lancet")
#> <spicy_style> "lancet" -- The Lancet
#>
#> Encoded rules (formatting only, not editorial conformity):
#> - decimal mark: midline dot U+00B7 on every number
#> - p-values: 2 significant figures capped at 4 decimals, floor <0·0001, leading zero kept
#> - confidence intervals: en dash between bounds (matches the journal's published examples; not a written rule)
#> - table note: no lead-in word (matches the journal's model tables and its published tables; not a written rule)
#> - table note: abbreviations spelled out at its end, one "HR=hazard ratio." sentence each, alphabetical; n, N, p, SD, SE, IQR and CI not (matches the journal's model tables and its published tables; not a written rule)
#> - the mean and the median headed "Mean" and "Median" (matches the journal's model tables, "median (IQR), mean (SD)"; not a written rule)
#> - sample size: the n of each group in its column header (matches the journal's model tables, "Drug A (n=500)"; not a written rule)
#>
#> Source: Information for Authors (April 2026); Randomised trials / Observational studies formatting guidelines (July 2025)
#> https://www.thelancet.com/pb-assets/Lancet/authors/tl-info-for-authors-1690986041530.pdf
#> 2026-04, consulted 2026-08-14
#>
#> Levers:
#> p_style standard
#> p_digits 4
#> p_floor 0.0001
#> p_sigfig 2
#> decimal_mark ·
#> ci_sep –
#> note_label ""
#> sample_size header