Available Options

Options can be set with options() and change the default behavior of tinytable. For example, to format all tables to 4 digits when calling tt(), we can do:

options(tinytable_tt_digits = 4)
tt(head(iris))

You can either set options in a script (usually at the top) or via .Rprofile. Note that you want to be cautious with putting things in .Rprofile since they might make results not reproducible (e.g. if you change tinytable_format_digits in .Rprofile, the table will be formatted differently).

Default values for function arguments

Most options are function specific and allow you to set default values. These all start with tinytable_X_ where X is tt/format/theme/print. See the corresponding help documentation for the what the argument looks like.

tt()

Sets default values for tt() arguments.

  • tinytable_tt_digits
  • tinytable_tt_caption
  • tinytable_tt_notes
  • tinytable_tt_width
  • tinytable_tt_theme
  • tinytable_tt_rownames

format_tt()

Sets default formats for different kinds of variables. see format_tt()

  • tinytable_format_digits
  • tinytable_format_num_fmt
  • tinytable_format_num_zero
  • tinytable_format_num_suffix
  • tinytable_format_num_mark_big
  • tinytable_format_num_mark_dec
  • tinytable_format_date
  • tinytable_format_bool
  • tinytable_format_other
  • tinytable_format_replace
  • tinytable_format_escape
  • tinytable_format_markdown
  • tinytable_format_quarto
  • tinytable_format_fn
  • tinytable_format_sprintf

save_tt()

  • tinytable_save_overwrite

theme_tt()

When using theme_tt(theme = "theme_name"), this allows you to set default arguments to the corresponding theme. See theme_tt() for details.

placement:

  • tinytable_theme_placement_float
  • tinytable_theme_placement_horizontal

resize:

  • tinytable_theme_resize_width
  • tinytable_theme_resize_direction

multipage:

  • tinytable_theme_multipage_rowhead
  • tinytable_theme_multipage_rowfoot

tabular:

  • tinytable_theme_tabular_style

print.tinytable()

tinytable_print_output

Global options

The rest of the options are a set of global options that apply when the tables are being built.

HTML

  • options(tinytable_html_mathjax = TRUE)
    • insert MathJax scripts in the HTML document. Warning: This may conflict with other elements of the page if MathJax is otherwise loaded.
  • options(tinytable_html_portable = TRUE)
    • plot_tt() inserts base 64-encoded images directly in the HTML file rather than use external links.

PDF

  • options(tinytable_pdf_clean = TRUE)
    • deletes temporary and log files.
  • options(tinytable_pdf_engine = "xelatex")
    • "xelatex", "pdflatex", "lualatex"

Quarto

The format_tt(quarto=TRUE) argument activates Quarto data processing for specific cells. This funcationality comes with a few warnings:

  1. Currently, Quarto provides a \QuartoMarkdownBase64{} LaTeX macro, but it does not appear to do anything with it. References and markdown codes may not be processed as expected in LaTeX.
  2. Quarto data processing can enter in conflict with tinytable styling or formatting options. See below for how to disable it.
  • options(tinytable_quarto_disable_processing = TRUE)
    • disables Quarto processing of cell content.
  • options(tinytable_print_rstudio_notebook = "inline") or "viewer"
    • Display tables inline in the notebook or in the viewer. Inline is an RStudio-only feature.
  • options(tinytable_quarto_figure = FALSE)
    • by default, do not include Typst tables in a figure environment in Quarto.

Setting this global option to FALSE may lead to conflicts with some tinytable features, but it also allows use of markdown and Quarto-specific code in table cells, such as cross-references.

x <- data.frame(Math = "x^2^", Citation = "@Lovelace1842")
fn <- function(z) sprintf("<span data-qmd='%s'></span>", z)
tt(x) |> format_tt(i = 1, fn = fn)

See this link for more details: https://quarto.org/docs/authoring/tables.html#disabling-quarto-table-processing