info_date_style()Appendix A — Quick reference
This appendix provides a consolidated reference for the gt package, including informational functions that display helpful lookup tables, descriptions of all built-in datasets, and a quick guide to the most commonly used helper functions.
A.1 Date and time style references
A.1.1 info_date_style()
Displays all 41 available date formatting styles for use with fmt_date() and fmt_datetime().
The resulting table shows:
- style number: the numeric identifier for each style
- style name: the string identifier (e.g.,
"iso","month_day_year") - example output: how each style renders a sample date
- flexible: whether the style adapts to locale settings
Use style names (or numbers) in your formatting calls:
fmt_date(columns = date_col, date_style = "month_day_year")
fmt_date(columns = date_col, date_style = 14)
A.1.2 info_time_style()
Displays all available time formatting styles for use with fmt_time() and fmt_datetime().
info_time_style()The table shows similar information to date styles: style numbers, names, example output, and locale flexibility.
A.2 Currency reference
A.2.1 info_currencies()
Displays a comprehensive table of all supported currencies, including their codes, symbols, and names.
info_currencies()The table includes:
- currency code: the 3-letter ISO 4217 code (e.g.,
"USD","EUR","JPY") - currency symbol: the symbol used in formatting (e.g.,
$,€,¥) - currency name: the full name of the currency
Use currency codes with fmt_currency():
fmt_currency(columns = price, currency = "EUR")
fmt_currency(columns = price, currency = "JPY")A.3 Locale reference
A.3.1 info_locales()
Displays all supported locales for internationalized formatting. Locales affect number formatting, date formatting, and translated text.
info_locales()The table shows locale codes and their corresponding languages/regions. Use these codes with:
- the
localeargument ingt() - the
localeargument in formatting functions - the
localeargument infmt_spelled_num()
gt(data, locale = "de")
fmt_number(columns = value, locale = "fr")
fmt_date(columns = date, locale = "ja")A.4 Color palette reference
A.4.1 info_paletteer()
The paletteer package provides access to hundreds of color palettes from various R packages. The info_paletteer() function displays available palettes that work well with data_color().
info_paletteer()The table groups palettes by their source package and shows color swatches for each palette. Use palette names with data_color():
data_color(
columns = value,
palette = "viridis::plasma"
)Palette names follow the format "package::palette".
A.5 Flag reference
A.5.1 info_flags()
Displays all available country flags that can be rendered with fmt_flag(), along with their country codes.
info_flags()The table shows:
- country code (2-letter): ISO 3166-1 alpha-2 codes
- country code (3-letter): ISO 3166-1 alpha-3 codes
- country name: full country name
- flag preview: the rendered flag icon
Use these codes with fmt_flag():
fmt_flag(columns = country_code)A.6 Icon reference
A.6.1 info_icons()
Displays all available Font Awesome icons for use with fmt_icon().
info_icons()The table shows icon names and rendered previews. Use icon names in your data or with fmt_icon():
A.7 Google Fonts reference
A.7.1 info_google_fonts()
Displays recommended Google Fonts for use with gt tables, along with information about how to use them.
info_google_fonts()Use Google Fonts with opt_table_font() or google_font():
gt(data) |>
opt_table_font(font = google_font("Roboto"))
gt(data) |>
tab_style(
style = cell_text(font = google_font("Fira Code")),
locations = cells_body(columns = code_col)
)A.8 Unit conversion reference
A.8.1 info_unit_conversions()
Displays all unit conversions supported by the unit_conversion() helper function. This is useful when you need to convert between measurement units.
info_unit_conversions()The table shows:
- unit class: the category of measurement (length, mass, volume, etc.)
- from units: available source units
- to units: available target units
- conversion factors: the multipliers used
Use with unit_conversion():
A.9 Built-in datasets
The gt package includes 18 datasets for learning and experimentation. These datasets appear throughout the documentation and examples.
A.9.1 Small example datasets
These compact datasets are ideal for quick experiments and learning the basics of gt.
| Dataset | Description | Rows | Use Case |
|---|---|---|---|
exibble |
A toy tibble with various data types | 8 | Testing formatters |
gtcars |
Specifications for 47 luxury/supercars | 47 | Car comparisons |
pizzaplace |
A year of pizza sales | 49,574 | Sales analysis |
A.9.2 Country and population data
These datasets provide demographic information useful for geographic visualizations and population analysis.
| Dataset | Description | Rows | Use Case |
|---|---|---|---|
countrypops |
Country populations 1960-2024 | ~13,000 | Time series, maps |
towny |
Ontario municipality populations | 414 | Canadian demographics |
peeps |
Personal information for fictional people | 100 | Contact directories |
A.9.3 Scientific and technical data
These datasets contain scientific measurements and constants, suitable for demonstrating technical table formatting.
| Dataset | Description | Rows | Use Case |
|---|---|---|---|
sza |
Solar zenith angles by location/time | 816 | Heatmaps |
constants |
Fundamental physical constants | 30 | Scientific tables |
reactions |
Atmospheric reaction rates | 1,344 | Chemistry data |
photolysis |
Photolysis rates for organic compounds | 1,590 | Chemistry data |
nuclides |
Nuclear data for isotopes | 3,384 | Nuclear chemistry |
A.9.4 Financial and geographic data
These datasets cover financial markets and location-based information for diverse table examples.
| Dataset | Description | Rows | Use Case |
|---|---|---|---|
sp500 |
S&P 500 daily data 1950-2015 | 16,607 | Financial analysis |
metro |
Paris Metro stations | 308 | Geographic data |
gibraltar |
May 2023 Gibraltar weather | 744 | Weather data |
films |
Cannes Film Festival competition | 1,607 | Entertainment data |
A.9.5 Clinical trial data
These datasets follow pharmaceutical industry conventions, useful for creating clinical study tables.
| Dataset | Description | Rows | Use Case |
|---|---|---|---|
rx_adsl |
ADSL-style clinical trial data | 182 | Clinical tables |
rx_addv |
ADDV-style clinical trial data | 910 | Clinical tables |
illness |
Lab tests for illness tracking | 39 | Medical data |
A.9.6 Using built-in datasets
All datasets are automatically available when you load the gt package, requiring no additional data import steps.
# View first few rows
head(exibble)# A tibble: 6 × 9
num char fctr date time datetime currency row group
<dbl> <chr> <fct> <chr> <chr> <chr> <dbl> <chr> <chr>
1 0.111 apricot one 2015-01-15 13:35 2018-01-01 02:22 50.0 row_1 grp_a
2 2.22 banana two 2015-02-15 14:40 2018-02-02 14:33 18.0 row_2 grp_a
3 33.3 coconut three 2015-03-15 15:45 2018-03-03 03:44 1.39 row_3 grp_a
4 444. durian four 2015-04-15 16:50 2018-04-04 15:55 65100 row_4 grp_a
5 5550 <NA> five 2015-05-15 17:55 2018-05-05 04:00 1326. row_5 grp_b
6 NA fig six 2015-06-15 <NA> 2018-06-06 16:11 13.3 row_6 grp_b
| mfr | model | year | hp | mpg_c |
|---|---|---|---|---|
| Ford | GT | 2017 | 647 | 11 |
| Ferrari | 458 Speciale | 2015 | 597 | 13 |
| Ferrari | 458 Spider | 2015 | 562 | 13 |
| Ferrari | 458 Italia | 2014 | 562 | 13 |
| Ferrari | 488 GTB | 2016 | 661 | 15 |
A.10 Helper functions quick reference
A.10.1 Text and content helpers
These functions allow you to include formatted text in table headers, labels, and notes.
| Function | Purpose | Example |
|---|---|---|
md() |
Interpret text as Markdown | tab_header(title = md("**Bold Title**")) |
html() |
Interpret text as HTML | tab_header(title = html("<em>Styled</em>")) |
latex() |
Interpret text as LaTeX | tab_source_note(latex("\\textit{Note}")) |
A.10.2 Unit helpers
These functions specify measurement units for sizing columns and other table elements.
| Function | Purpose | Example |
|---|---|---|
px() |
Specify pixels | cols_width(col ~ px(150)) |
pct() |
Specify percentage | cols_width(col ~ pct(25)) |
A.10.3 Dynamic value helpers
These functions enable data-driven formatting by referencing values from other columns or defining custom formats.
| Function | Purpose | Example |
|---|---|---|
from_column() |
Reference column values | fmt_number(decimals = from_column("precision")) |
currency() |
Custom currency symbol | fmt_currency(currency = currency(symbol = "BTC")) |
A.10.4 Color helpers
These functions help manipulate colors for consistent styling across your tables.
| Function | Purpose | Example |
|---|---|---|
adjust_luminance() |
Lighten/darken colors | adjust_luminance("steelblue", steps = 1) |
A.10.5 Font helpers
These functions provide access to web fonts and system font stacks for typography customization.
| Function | Purpose | Example |
|---|---|---|
google_font() |
Specify Google Font | opt_table_font(font = google_font("Roboto")) |
default_fonts() |
Get default font stack | default_fonts() |
system_fonts() |
Get system font stack | system_fonts("humanist") |
A.10.6 Location helpers (for tab_style(), tab_footnote(), etc.)
These functions target specific regions of the table for styling, footnotes, or other modifications.
| Function | Target |
|---|---|
cells_title() |
Table title and subtitle |
cells_stubhead() |
Stubhead label |
cells_column_labels() |
Column labels |
cells_column_spanners() |
Column spanner labels |
cells_row_groups() |
Row group labels |
cells_stub() |
Stub (row labels) |
cells_body() |
Body cells |
cells_summary() |
Group summary cells |
cells_grand_summary() |
Grand summary cells |
cells_stub_summary() |
Stub cells in summaries |
cells_stub_grand_summary() |
Stub cells in grand summary |
cells_footnotes() |
Footnote area |
cells_source_notes() |
Source note area |
A.10.7 Style helpers (for tab_style())
These functions define visual properties that can be applied to targeted table locations.
| Function | Purpose |
|---|---|
cell_text() |
Text styling (color, size, weight, etc.) |
cell_fill() |
Background color |
cell_borders() |
Border styling |
A.10.8 Selection helpers (for column selection)
These tidyselect-compatible functions help you specify which columns to target in formatting and styling operations.
| Function | Purpose |
|---|---|
stub() |
Select stub column |
row_group() |
Select row group column |
everything() |
Select all columns |
starts_with() |
Columns starting with prefix |
ends_with() |
Columns ending with suffix |
contains() |
Columns containing string |
matches() |
Columns matching regex |
where() |
Columns matching predicate |
A.10.9 Utility helpers
These functions provide miscellaneous utilities for table IDs, LaTeX output, and special character handling.
| Function | Purpose |
|---|---|
random_id() |
Generate a random table ID |
escape_latex() |
Escape special LaTeX characters |
gt_latex_dependencies() |
Get LaTeX package requirements |