Synthèse automatique
Skill de référence pour produire des tableaux de qualité publication en R avec gt, kableExtra et modelsummary, de la mise en forme des nombres jusqu'à l'export.
Points forts
- Découpe explicite entre trois bibliothèques complémentaires : gt pour la grammaire des tableaux, kableExtra pour knitr/Quarto, modelsummary pour les sorties de régression
- Organisation en fichiers de référence ciblés (quickstart, formatting, modelsummary-tables, export) avec indication du moment où lire chacun
- Signale le piège de modelsummary 2.x où tinytable est le backend par défaut et où il faut demander output = "gt" explicitement
- Versions des bibliothèques épinglées (gt 1.3.0, kableExtra 1.4.0, modelsummary 2.6.0, knitr 1.51) et renvoi vers le skill Python équivalent great-tables
Limites
- Uniquement pour R : aucun exemple Python, et le skill great-tables est seulement mentionné, pas fourni
- La couverture de modelsummary reste superficielle et renvoie au skill r-stats pour les erreurs standard robustes ou clusterisées
- Ne traite ni les graphiques (ggplot2) ni la structure de document (Quarto), qui sont explicitement délégués à d'autres skills
À utiliser lorsqu'un script ou un document R doit générer un tableau formaté : statistiques descriptives, tableau récapitulatif ou tableau de régression prêt à publier.
À éviter si le langage d'exécution est Python, ou si le besoin porte sur un graphique plutôt que sur un tableau.
Analyse de sécurité
SûrThe skill is purely informational/documentation for R table formatting libraries. It declares no tools and contains no executable commands, network access, destructive operations, or data exfiltration instructions.
Aucun point d'attention détecté
Comment cette analyse est faiteExemples
Using R and gt, build a table of descriptive statistics (n, mean, sd) by treatment group, format the numbers with fmt_number to 2 decimals, add a column spanner over the statistics columns, and a source note.I have three lm models in R. Use modelsummary with output = "gt" to put them side by side with custom coefficient labels, clustered standard errors via the vcov argument, and goodness-of-fit rows at the bottom.Render this gt table in my Quarto .qmd and save it with gtsave() to both PNG and LaTeX so I can include it in my paper.name: gt description: >- R table formatting with gt, kableExtra, modelsummary. Publication-quality tables: gt() grammar-of-tables, fmt_() formatting, tab_() structure, gtsave() export. Use when execution language is R. Python equivalent: great-tables (use when execution language is Python). autoload: never metadata: audience: research-coders domain: r-library library-version: "gt 1.3.0" skill-last-updated: "2026-05-13" tags: ["r", "tables", "gt", "kableExtra", "modelsummary", "formatting"]
gt Skill
R table formatting ecosystem for publication-quality tables. Covers gt 1.3.0 for
grammar-of-tables construction (gt(), fmt_() number formatting, tab_() structure,
cols_*() column operations, gtsave() export), kableExtra 1.4.0 for knitr/kable
HTML and LaTeX table styling in Quarto documents, and modelsummary 2.6.0 for
formatting regression output from lm/glm/fixest/plm models into publication tables.
Use when execution language is R and the task involves creating formatted data
tables, summary tables, or regression tables for reports or papers. Python
counterpart: the great-tables skill (same author, same grammar of tables) —
use it when execution language is Python. For visualization (charts/plots), use
ggplot2 instead. For document structure and rendering, use quarto instead.
What is gt?
gt implements a grammar of tables for R, analogous to ggplot2's grammar of graphics but for tabular output:
- Declarative: Build tables by layering formatting, structure, and style
- Pipeline-friendly: Chain operations with
|>(data frame in, gt table out) - Rich formatting: Number formatting (fmt_number, fmt_percent, fmt_currency), conditional styling, color scales, icons, images in cells
- Structured: Table header, column spanners, row groups, summary rows, footnotes, source notes
- Export: HTML, PNG, LaTeX, Word, RTF via gtsave()
kableExtra extends knitr's kable() for HTML and LaTeX table styling:
- Lightweight alternative when gt is overkill (simple summary tables in Quarto)
- Row/column styling, striped rows, scroll boxes, grouped rows
- Tight integration with Quarto's knitr engine
modelsummary formats regression output into publication-ready tables:
- Supports 100+ model classes (lm, glm, fixest, plm, survey, etc.)
- Side-by-side model comparison with custom coefficient labels
- Output to gt, kableExtra, HTML, LaTeX, Word, markdown, PNG
- Robust/clustered SEs via
vcovargument (no re-fitting needed) - Already covered in depth by the r-stats skill (
reporting.md) and referenced by fixest -- this skill provides the table-formatting perspective
Version Notes
- gt 1.3.0: Stable release. Full grammar-of-tables API.
fmt_*()family for number formatting,tab_*()for structural elements,cols_*()for column operations,opt_*()for table options. - kableExtra 1.4.0: Stable release.
kbl()replacesknitr::kable()as the recommended entry point. Full HTML and LaTeX styling support. - modelsummary 2.6.0: Supports gt and kableExtra as output backends. The
default output backend in modelsummary 2.x is tinytable — request a gt
object explicitly with
output = "gt". See r-stats skillreporting.mdfor comprehensive modelsummary coverage. - knitr 1.51: Provides the underlying
kable()function that kableExtra extends.
How to Use This Skill
Reference File Structure
| File | Purpose | When to Read |
|------|---------|--------------|
| quickstart.md | Basic gt() table, headers/footers/source notes, simple formatting | Starting out or need a quick table |
| formatting.md | fmt_*() family, conditional styling, spanners, row groups, summary rows | Detailed formatting and structure |
| modelsummary-tables.md | Regression tables via modelsummary(), customization, multi-model comparison | Formatting regression output |
| export.md | gtsave(), kableExtra in Quarto, inline tables in .qmd, output formats | Saving or embedding tables |
Reading Order
- Quick data table? Start with
quickstart.md - Complex formatting? Read
formatting.md - Regression table? Read
modelsummary-tables.md - Saving or embedding? Read
export.md - Simple Quarto table? Read
export.md(kableExtra section)
Related Skills
| Skill | Relationship |
|-------|-------------|
| ggplot2 | Visualization (charts/plots) -- use ggplot2 for figures, gt for tables |
| quarto | Document rendering -- gt/kableExtra tables render in .qmd documents |
| fixest | Regression output -- fixest models feed into modelsummary/gt tables. fixest's own etable() is an alternative to modelsummary for fixest-only output |
| r-stats | Regression output -- lm/glm models feed into modelsummary/gt tables. r-stats reporting.md has comprehensive modelsummary coverage |
| plm | Panel model output -- plm models feed into modelsummary/gt tables |
| data-scientist | Methodology guidance for what to present in tables |
Python counterpart: Use the great-tables skill for Python table
formatting. The great-tables package (version 0.21.0, by the same author as
gt, implementing the same grammar of tables) is DAAF's Python table-formatting
tool — load that skill when execution language is Python. Note surface
differences from gt: method chaining instead of |>, 0-based cols_merge
pattern indices, Polars expressions in grand_summary_rows, and HTML/LaTeX
export in-process (but no working PNG export in the container). For regression
tables in Python, great-tables has no modelsummary equivalent — use pyfixest's
etable() or statsmodels' summary().
Quick Decision Trees
"I need to make a table"
What kind of table?
+-- Data summary table (descriptive stats, crosstabs)
| +-- Simple (few rows/columns, minimal formatting)
| | +-- In a Quarto doc? --> kableExtra kbl() in ./references/export.md
| | +-- Standalone? --> gt() in ./references/quickstart.md
| +-- Complex (conditional formatting, row groups, summary rows)
| +-- gt() in ./references/formatting.md
+-- Regression table (model coefficients)
| +-- Single model --> ./references/modelsummary-tables.md
| +-- Multiple models side-by-side --> ./references/modelsummary-tables.md
| +-- fixest models only --> Consider fixest etable() (see fixest skill)
| OR modelsummary() for more customization
+-- Frequency / cross-tabulation table
| +-- gt() with row groups --> ./references/formatting.md
+-- Table with color scales or conditional formatting
+-- gt tab_style() or data_color() --> ./references/formatting.md
"Which package should I use?"
Choosing a table package?
+-- Publication-quality data table with rich formatting
| +-- gt() (most flexible, best output quality)
+-- Regression table (multiple models, SEs, goodness-of-fit)
| +-- modelsummary() (purpose-built for this)
+-- Simple table in a Quarto document
| +-- kableExtra kbl() (lightweight, integrates with knitr)
+-- Quick console output (not for publication)
| +-- print() or knitr::kable() (no extra packages needed)
+-- LaTeX table for a journal submission
+-- gt() with gtsave("file.tex") OR modelsummary(output = "latex")
File-First Execution in Research Workflows
In DAAF research pipelines, tables are generated through script files in
scripts/stage8_analysis/, not interactively. This ensures auditability and
reproducibility.
The pattern:
- Write table code to
scripts/stage8_analysis/{step}_{table-name}.R - Execute via
bash {BASE_DIR}/scripts/run_with_capture.sh {script_path} - Output gets appended to the script as comments
- Use
gtsave()to save tables to the project output directory
See agent_reference/SCRIPT_EXECUTION_REFERENCE.md for the mandatory file-first
execution protocol.
Quick Reference
Essential Setup
library(gt)
library(kableExtra)
library(modelsummary)
Basic gt Table
tbl <- df |>
gt() |>
tab_header(
title = "Table Title",
subtitle = "Subtitle or description"
) |>
tab_source_note("Source: Dataset name, year.") |>
fmt_number(columns = where(is.numeric), decimals = 2)
Core gt Operations
| Operation | Code |
|-----------|------|
| Create table | gt(df) or df |> gt() |
| Title/subtitle | tab_header(title, subtitle) |
| Source note | tab_source_note("Source: ...") |
| Footnote | tab_footnote(footnote, locations) |
| Format numbers | fmt_number(columns, decimals) |
| Format percent | fmt_percent(columns, decimals) |
| Format currency | fmt_currency(columns, currency) |
| Format date | fmt_date(columns, date_style) |
| Column spanner | tab_spanner(label, columns) |
| Row group | gt(groupname_col = "group_var") |
| Summary row | summary_rows(groups, fns, columns) |
| Conditional style | tab_style(style, locations) |
| Column labels | cols_label(col1 = "Label 1") |
| Hide columns | cols_hide(columns) |
| Column width | cols_width(col1 ~ px(150)) |
| Save | gtsave(tbl, "file.html") |
kableExtra Quick Pattern
df |>
kbl(format = "html", digits = 2, caption = "Table Title") |>
kable_styling(bootstrap_options = c("striped", "hover", "condensed")) |>
add_header_above(c(" " = 1, "Group A" = 2, "Group B" = 2))
modelsummary Quick Pattern
modelsummary(
list("Model 1" = fit1, "Model 2" = fit2),
stars = c("*" = 0.05, "**" = 0.01, "***" = 0.001),
coef_rename = c("x1" = "Education", "x2" = "Experience"),
gof_map = c("nobs", "r.squared", "adj.r.squared"),
output = "gt"
)
Topic Index
| Topic | Reference File |
|-------|---------------|
| Basic gt table creation | ./references/quickstart.md |
| tab_header, tab_source_note | ./references/quickstart.md |
| tab_footnote | ./references/quickstart.md |
| Simple number formatting | ./references/quickstart.md |
| cols_label column renaming | ./references/quickstart.md |
| fmt_number, fmt_percent, fmt_currency | ./references/formatting.md |
| fmt_date, fmt_integer | ./references/formatting.md |
| Conditional formatting (tab_style) | ./references/formatting.md |
| Color scales (data_color) | ./references/formatting.md |
| Column spanners (tab_spanner) | ./references/formatting.md |
| Row groups | ./references/formatting.md |
| Summary rows | ./references/formatting.md |
| Grand summary | ./references/formatting.md |
| Column width and alignment | ./references/formatting.md |
| Merge cells | ./references/formatting.md |
| modelsummary basic usage | ./references/modelsummary-tables.md |
| Multi-model comparison | ./references/modelsummary-tables.md |
| Coefficient renaming and omission | ./references/modelsummary-tables.md |
| Custom statistics rows | ./references/modelsummary-tables.md |
| Robust/clustered SEs in tables | ./references/modelsummary-tables.md |
| fixest models in modelsummary | ./references/modelsummary-tables.md |
| Stars and significance formatting | ./references/modelsummary-tables.md |
| gtsave to HTML/PNG/LaTeX | ./references/export.md |
| kableExtra in Quarto | ./references/export.md |
| Inline tables in .qmd | ./references/export.md |
| Output format comparison | ./references/export.md |
Citation
When gt is used as a primary table-formatting tool, include in the report's Software & Tools references:
Iannone, R., Cheng, J., Schloerke, B., Hughes, E., Lauer, A., & Seo, J. (2024). gt: Easily Create Presentation-Ready Display Tables. R package version 1.3.0. https://gt.rstudio.com/
Cite when: gt produces tables included in the report or deliverables. Do not cite when: Only used for quick exploratory tables not included in deliverables.
For modelsummary citation (when used for regression tables):
Arel-Bundock, V. (2022). "modelsummary: Data and Model Summaries in R." Journal of Statistical Software, 103(1), 1-23.
For kableExtra citation (when used for Quarto table styling):
Zhu, H. (2024). kableExtra: Construct Complex Table with kable and Pipe Syntax. R package version 1.4.0.
Du fichier au premier essai
Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.
Consulter la source et ses fichiers annexesCe téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.
1. Télécharger le fichier
Télécharger SKILL.mdDepuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/gt-grammar-of-tables-for-r-mrwak8pi/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.
Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.
mkdir -p '.skill-downloads/gt-grammar-of-tables-for-r-mrwak8pi' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/gt-grammar-of-tables-for-r-mrwak8pi/download' --output '.skill-downloads/gt-grammar-of-tables-for-r-mrwak8pi/SKILL.md.part' && mv '.skill-downloads/gt-grammar-of-tables-for-r-mrwak8pi/SKILL.md.part' '.skill-downloads/gt-grammar-of-tables-for-r-mrwak8pi/SKILL.md'2. Vérifier les prérequis
Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.
Extrait original : Quick Reference
Essential Setup
library(gt)
library(kableExtra)
library(modelsummary)
Basic gt Table
tbl <- df |>
gt() |>
tab_header(
title = "Table Title",
subtitle = "Subtitle or description"
) |>
tab_source_note("Source: Dataset name, year.") |>
fmt_number(columns = where(is.numeric), decimals = 2)
Core gt Operations
| Operation | Code |
|---|---|
| Create table | gt(df) or `df |
| Title/subtitle | tab_header(title, subtitle) |
| Source note | tab_source_note("Source: ...") |
| Footnote | tab_footnote(footnote, locations) |
| Format numbers | fmt_number(columns, decimals) |
| Format percent | fmt_percent(columns, decimals) |
| Format currency | fmt_currency(columns, currency) |
| Format date | fmt_date(columns, date_style) |
| Column spanner | tab_spanner(label, columns) |
| Row group | gt(groupname_col = "group_var") |
| Summary row | summary_rows(groups, fns, columns) |
| Conditional style | tab_style(style, locations) |
| Column labels | cols_label(col1 = "Label 1") |
| Hide columns | cols_hide(columns) |
| Column width | cols_width(col1 ~ px(150)) |
| Save | gtsave(tbl, "file.html") |
kableExtra Quick Pattern
df |>
kbl(format = "html", digits = 2, caption = "Table Title") |>
kable_styling(bootstrap_options = c("striped", "hover", "condensed")) |>
add_header_above(c(" " = 1, "Group A" = 2, "Group B" = 2))
modelsummary Quick Pattern
modelsummary(
list("Model 1" = fit1, "Model 2" = fit2),
stars = c("*" = 0.05, "**" = 0.01, "***" = 0.001),
coef_rename = c("x1" = "Education", "x2" = "Experience"),
gof_map = c("nobs", "r.squared", "adj.r.squared"),
output = "gt"
)
Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.
3. Charger la skill
Après vérification, copiez le dossier complet dans le projet avec l’une des commandes ci-dessous, puis ouvrez une nouvelle session de l’outil. La commande s’arrête si un dossier du même nom existe déjà : comparez les fichiers avant de le remplacer.
Claude Code
test -f '.skill-downloads/gt-grammar-of-tables-for-r-mrwak8pi/SKILL.md' && test -s '.skill-downloads/gt-grammar-of-tables-for-r-mrwak8pi/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/gt' && cp -R '.skill-downloads/gt-grammar-of-tables-for-r-mrwak8pi' '.claude/skills/gt'Cursor
test -f '.skill-downloads/gt-grammar-of-tables-for-r-mrwak8pi/SKILL.md' && test -s '.skill-downloads/gt-grammar-of-tables-for-r-mrwak8pi/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/gt' && cp -R '.skill-downloads/gt-grammar-of-tables-for-r-mrwak8pi' '.cursor/skills/gt'Codex
test -f '.skill-downloads/gt-grammar-of-tables-for-r-mrwak8pi/SKILL.md' && test -s '.skill-downloads/gt-grammar-of-tables-for-r-mrwak8pi/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/gt' && cp -R '.skill-downloads/gt-grammar-of-tables-for-r-mrwak8pi' '.agents/skills/gt'OpenSkills
OpenSkills doit déjà être installé. La procédure locale install/read est contrôlée avec OpenSkills 1.5.0, qui exige Node.js ≥ 20.6.0. Aucun slug du catalogue n’est résolu automatiquement.
Installation officielle d’OpenSkillsopenskills install './.skill-downloads/gt-grammar-of-tables-for-r-mrwak8pi'openskills read 'gt-grammar-of-tables-for-r-mrwak8pi'La lecture doit afficher le contenu du fichier installé et son dossier de base. Elle ne lance ni la skill ni ses dépendances.
Pour un agent qui lit AGENTS.md, synchronisez ensuite l’index. Cette commande modifie AGENTS.md : relisez le diff avant de l’utiliser.
openskills syncMode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.
4. Faire un premier essai
Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :
Lis .skill-downloads/gt-grammar-of-tables-for-r-mrwak8pi/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.
Créer des cartes interactives avec kepler.gl
Data & IA
Création de cartes interactives et export HTML autonome avec le package Python keplergl, à partir de données géospatiales (DataFrame, GeoJSON, CSV).
Optimisation de paramètres par agent
Data & IA
Guide d'optimisation de systèmes configurables avec objectif mesurable, via des essais bornés et une recommandation fondée sur des preuves.
Relance des visiteurs ICP
Data & IA
Identifiez les utilisateurs inscrits correspondant au profil client idéal mais qui n'ont pas activé, et rédigez des messages de relance personnalisés pour les réengager.