A small grammar of tables, built on a JSON spec and a tiny bit of JavaScript
The landscape of data reporting in the R programming environment has seen a significant shift with the official release of the "lt" package on the Comprehensive R Archive Network (CRAN). Developed by Yihui Xie, a prominent figure in the R community and the creator of influential tools such as knitr and blogdown, the new package—short for "lightweight tables"—aims to redefine how researchers and data scientists generate HTML-based tables. By prioritizing a minimalist dependency footprint and leveraging a decoupled architecture, the lt package addresses long-standing concerns regarding the bloat and complexity of modern data visualization libraries.
The release marks a pivotal moment for developers working in environments where installation speed, system resources, and long-term maintainability are critical. Unlike traditional table-making packages that bundle extensive back-end logic and external system dependencies, lt operates on a lean framework, utilizing base R and the xfun utility package on the server side, while delegating the heavy lifting of rendering to a compact, 10-kilobyte JavaScript runtime in the browser.
The Genesis of Lightweight Tables: Addressing Dependency Bloat
The motivation behind the development of lt stems from a common frustration among R users: the "recursive dependency tree" that often accompanies feature-rich packages. During the initial conceptualization of the project approximately two years ago, Xie noted the substantial overhead required to install the "gt" (Grammar of Tables) package on Linux systems. The installation process for gt frequently necessitates the compilation of numerous underlying packages, including V8—a high-performance JavaScript and WebAssembly engine—and sass, which facilitates CSS extension.
In many production environments, particularly those involving restricted servers or automated Continuous Integration (CI) pipelines, these dependencies can lead to prolonged installation times and potential points of failure. The lt package was born out of a desire to see how much of the "grammar of tables" philosophy could be retained while stripping away the heavy machinery of htmlwidgets, V8, and LaTeX-related dependencies.
The project received significant institutional support from Merck & Co., specifically through the advocacy of Keaven Anderson. The pharmaceutical giant sought to streamline its internal workflows, aiming to make clinical reporting packages such as gsDesign and gsDesign2 faster and more efficient. By integrating a lightweight table engine, these specialized packages can operate with greater agility, reducing the time from data analysis to report generation in highly regulated environments.
Architecture and Technical Implementation
The core innovation of the lt package lies in its architectural separation of data declaration and visual rendering. In traditional R table packages, the R code is responsible for generating the final HTML, LaTeX, or RTF string. This often requires the R environment to handle complex styling logic and formatting rules.
In contrast, lt utilizes a JSON-based specification. When a user creates a table in R using the lt grammar, the package does not draw the table immediately. Instead, it serializes the data and the requested operations—such as grouping, formatting, or spanning—into a compact JSON object. This object is then passed to the browser, where a single vanilla JavaScript file, lt.js, interprets the specification and builds the HTML <table> element on page load.
The R Interface
The R-side interface remains familiar to users of the "Tidyverse" or gt. It utilizes a pipe-oriented syntax that allows users to layer table components incrementally. A typical workflow involves:
- Data Initialization: Passing a data frame to the
lt()function. - Grouping and Spanning: Using functions like
lt_group()to categorize rows andlt_spanner()to create multi-column headers. - Formatting: Applying
lt_format()to control decimal places and scientific notation. - Annotations: Adding titles, subtitles, and footnotes through
lt_header()andlt_footnote().
The JavaScript Runtime
By moving the rendering logic to lt.js, the package achieves a "write once, render anywhere" capability. Because the JavaScript engine is independent of R, the same JSON specification could theoretically be generated by any programming language, including Python, Julia, or Rust. This approach differs from the "Great Tables" project, which required a complete rewrite of the gt logic in Python. With lt, the underlying engine remains constant, requiring only a thin wrapper in other languages to produce the necessary JSON input.
Interactive Features and the "Access to Truth"
One of the most distinctive features of the lt package is its commitment to data integrity through interactivity. In standard static tables, formatting a number (e.g., rounding 3.14159 to 3.14) permanently obscures the underlying raw data in the final output.

The lt package preserves the original data within the browser’s memory. This enables several interactive functions:
- Hover Tooltips: When a user hovers over a formatted cell, the browser displays the raw, unformatted value in a tooltip.
- Global Toggle: Users can use keyboard shortcuts, such as
Alt + Click, to reveal all raw values within a table simultaneously.Alt + Double-Clicktoggles this view for every lt-rendered table on a given page.
This functionality addresses a common tension in scientific reporting between aesthetic readability and numerical precision. By allowing the "truth" to remain accessible beneath the formatted surface, lt provides a more robust tool for peer review and data verification.
A Chronology of the "HTML-First" Philosophy
The release of lt is the latest milestone in a decade-long trajectory of moving R reporting away from legacy formats like LaTeX and Microsoft Office.
- 2018: Xie published "In HTML I Trust," an influential blog post arguing that HTML’s flexibility, accessibility, and ease of styling make it the superior format for data communication.
- 2024: The conceptual framework for lt was established, focusing on a JSON-spec model to decouple R from the rendering process.
- Early 2026: Xie announced the cessation of LaTeX support in his workflows, coinciding with the addition of Typst support to knitr.
- July 2026: The lt package was officially released on CRAN, offering a production-ready alternative for lightweight table generation.
- Future Outlook: Development is reportedly underway for a "lightweight grammar of graphics," which intends to apply similar minimalist principles to data visualization and plotting.
Comparison with Existing Frameworks
While lt draws inspiration from the "Grammar of Tables" pioneered by the gt package, it represents a different set of priorities. The gt package remains the industry standard for producing high-quality tables across multiple formats, including PDF, RTF, and Word. Its feature set is exhaustive, supporting complex styling and conditional formatting that lt, by design, does not aim to match.
However, the trade-off is one of weight and speed. The lt package is specifically optimized for HTML-centric workflows. By narrowing the scope to HTML, the package eliminates the need for the heavy dependencies required to bridge R with document processors like LaTeX or MS Office. This makes lt particularly well-suited for:
- Dashboards and Web Reports: Where page load speed and JavaScript efficiency are paramount.
- Large-Scale Documentation: Where thousands of tables might be rendered across a single site.
- Collaborative Environments: Where users may have varying levels of system-level permissions to install complex R dependencies.
Static Exporting and Portability
Despite its HTML-first orientation, the lt package acknowledges the ongoing requirement for static artifacts in academic and corporate settings. To bridge this gap, the package includes an lt_export() function.
This utility allows users to save tables as standalone PDF or PNG files. Rather than relying on LaTeX to generate these files, lt utilizes a headless browser—such as Chrome, Chromium, or Microsoft Edge—to render the HTML and then capture a high-resolution, tightly cropped image or document. This method ensures that the visual styling of the table remains consistent between the interactive web version and the static exported version.
Broader Impact on the R Ecosystem
The introduction of lt reflects a growing trend toward "headless" or "spec-based" tools in data science. By reducing the complexity of the R-side code and empowering the browser, Xie has provided a template for future package development.
Industry analysts suggest that the success of lt may encourage a shift in how other common data tasks are handled. If the "grammar of graphics" project follows the same path, the R community could see a significant reduction in the installation footprint of the standard data science stack. Furthermore, the open invitation for Python developers to create a front-end for the lt.js runtime highlights a move toward cross-language interoperability that prioritizes shared engines over language-specific re-implementations.
As of July 2026, the package is available for installation via CRAN and through development repositories. An online playground has also been established to allow users to experiment with the JSON specification and R syntax without requiring a local installation, further lowering the barrier to entry for this new standard in table generation.