tabviz

Interactive Tables with Embedded Visualizations for R

Overview

tabviz is an R htmlwidgets package for creating interactive tables with embedded visualizations. Build dashboard tables, forest plots, and rich data displays with 16+ column types including sparklines, bar charts, badges, and confidence intervals.

Creating Tables

Use tabviz() with explicit column definitions:

tabviz(data,
  label = "study",
  columns = list(
    col_text("category"),
    col_numeric("value"),
    viz_forest(point = "hr", lower = "lo", upper = "hi",
               scale = "log", null_value = 1),
    col_interval("HR (95% CI)", point = "hr", lower = "lo", upper = "hi"),
    col_sparkline("trend")
  )
)

Features

Visualization

  • 9 preset themes (JAMA, Lancet, Nature, etc.)
  • 16+ column types (bars, p-values, sparklines)
  • Hierarchical grouping with collapsible sections
  • Multiple effects per row (ITT vs Per-Protocol)

Interactivity

  • Hover tooltips with custom content
  • Column sorting and resizing
  • Row selection and highlighting
  • Split view navigation for subgroups

Export

  • SVG, PNG, PDF output
  • Publication-quality figures at 300 DPI
  • Consistent rendering between web and export

Developer Experience

  • Fluent API with R pipes
  • Declarative column system
  • Type-safe styling with column mapping

Installation

# install.packages("pak")
pak::pak("kaskarn/tabviz")

Quick Example

library(tabviz)

tabviz(data,
  label = "study",
  columns = list(
    col_text("category"),
    viz_forest(point = "estimate", lower = "ci_lower", upper = "ci_upper",
               scale = "log", null_value = 1),
    col_interval("Est (95% CI)", point = "estimate",
                 lower = "ci_lower", upper = "ci_upper"),
    col_numeric("n")
  )
)

Guide

Learn how to use tabviz:

Chapter Description
Quick Start Installation and basic usage
Columns Column types, usage, and column groups
Row Styling Headers, summaries, indentation, and badges
Cell Styling Per-cell conditional formatting
Row Groups Collapsible sections from column values
Forest Plots Adding forest columns with viz_forest()
Split Plots Sidebar navigation for subgroups
Themes Preset themes and customization
Shiny Integration Reactive tables
Export SVG, PNG, PDF output

More Resources