tinytable
  • Tutorial (HTML)
    • Tiny Tables
    • Formatting
    • Style
    • Groups and labels
    • Plots and images
    • Themes
    • HTML customization
    • Notebooks
    • Interactive tables
    • Tips and Tricks
    • Gallery
  • Tutorial (LaTeX)
  • Tutorial (Typst)
  • Gallery
  1. Functions
  2. Helpers
  3. print
  • Tutorial (HTML)
    • Tiny tables
    • Format
    • Style
    • Groups and labels
    • Plots and images
    • Themes
    • HTML
    • Notebooks
    • Interactive tables
    • Tips and tricks
    • Alternatives
    • Gallery
  • Tutorial (LaTeX)
  • Tutorial (Typst)
  • Tutorial (Word)
  • Gallery
  • Functions
    • tt
    • format_tt
    • style_tt
    • group_tt
    • plot_tt
    • save_tt
    • Theme formats
      • theme_html
      • theme_latex
      • theme_typst
    • Theme styles
      • theme_tinytable
      • theme_grid
      • theme_revealjs
      • theme_rotate
      • theme_striped
      • theme_empty
      • theme_tt (deprecated)
    • Helpers
      • print
      • rbind2
  • News
  • License
  • Citation

On this page

  • Print, display, or convert a tinytable object
    • Description
    • Usage
    • Arguments
    • Details
    • Value
  1. Functions
  2. Helpers
  3. print

Print, display, or convert a tinytable object

Description

This function is called automatically by R whenever a tinytable object is anprinted to the console or in an HTML viewer pane.

Usage

## S3 method for class 'tinytable'
print(x, output = get_option("tinytable_print_output", default = NULL), ...)

Arguments

x A data frame, data table, or tibble to be rendered as a table.
output

Format in which a Tiny Table is printed. One of:

  • NULL: automatically chosen based on context (see below).

  • “html”: HTML table. In interactive mode, displayed in the viewer pane.

  • “latex”: LaTeX table using tabularray.

  • “markdown”: plain text markdown table.

  • “typst”: Typst table.

  • “dataframe”: formatted data frame.

  • “tabulator”: interactive HTML table using Tabulator.js.

  • “knitr”: PNG screenshot via webshot2, returned through knitr::include_graphics(). Useful for embedding styled tables in Rmarkdown or Quarto documents. Requires the webshot2 package.

  • “raster”: PNG screenshot via webshot2, drawn on the graphics device via grid::grid.raster(). Useful for pkgdown @examples and README files, where the plot is captured as an image. Requires the webshot2 and png packages. For README.Rmd files rendered with rmarkdown::render(), set knitr::opts_chunk$set(fig.path = “man/figures/README-”) in a setup chunk so that pkgdown copies the images correctly.

When output is NULL, the format is chosen automatically:

  • When called from a script in non-interactive mode, the default is "markdown" (interactive() == FALSE).

  • When called interactively in RStudio, the default is to display an HTML table in the viewer pane.

  • When called interactively in another development environment, the default is "markdown".

  • The default print output can be changed for an entire R session by calling: options(tinytable_print_output = “html”)

  • The default print output can be changed for a single tinytable object by modifying the output S4 slot.

… Other arguments are ignored.

Details

When printing to HTML in interactive() mode, a temporary file is created and viewer() is called to preview the file with the local browser (ex: Firefox or Chrome). The temporary file is then automatically cleaned up. On some operating systems, like some Linux distributions, browser do not have read access to the /tmp/ directory. In such cases, users can specify a custom location to store temporary HTML files. Note that this prevents tinytable from automatically cleaning up temporary files automatically.

options(tinytable_tempdir = “/home/username/temp_directory”)

Value

launch a browser window or cat() the table to console.

theme_tt (deprecated)
rbind2