Learn R Programming

h

u

x

t

a

b

l

e

Huxtable is an R package to create styled tables in multiple output formats, with a friendly, modern interface. Features include:

  • Control over text styling, number format, background colour, borders, padding and alignment.
  • Table cells can span multiple rows and/or columns.
  • Table manipulation via common dplyr functions.
  • Automatic formatting for rmarkdown and quarto documents.
  • huxreg() function for quick creation of regression tables.
  • Output to HTML, LaTeX, RTF, and Microsoft Word/Excel/Powerpoint, using the officer and openxlsx packages.
  • Output to PDF, PNG and SVG formats using typst.
  • Quick one-liners to print data frames into any supported format.
  • Formatted table display in the R console, including borders, colour, and text styles.

Installing

To install from r-universe:

install.packages("huxtable", repos = c(
  "https://hughjonesd.r-universe.dev",
  "https://cloud.r-project.org"
))

To install from CRAN:

install.packages("huxtable")

To install the latest version from github:

install.packages("remotes")
remotes::install_github("hughjonesd/huxtable")

Learning more

Check out the website, read the documentation or read the vignette.

Copy Link

Version

Install

install.packages('huxtable')

Monthly Downloads

9,421

Version

5.7.0

License

MIT + file LICENSE

Maintainer

David Hugh-Jones

Last Published

August 18th, 2025

Functions in huxtable (5.7.0)

mutate.huxtable

Use dplyr verbs with huxtable objects
by_rows

Set cell properties by row or column
caption_width

Set the width of the table caption
description-colors

Description of color format
caption_pos

Position the table's caption
cbind.huxtable

Combine rows or columns
column_to_header

Convert a column to header rows
by_values

Map specific cell values to cell properties
caption

Set the table caption
col_width

Set the width of table columns
escape_contents

Escape or unescape text in cells
[.huxtable

Subset a huxtable
fmt_pretty

Use prettyNum() to format numbers
fmt_percent

Format numbers as percent
header_cols

Mark rows or columns as headers
final

Return the last n rows or columns
font

Set the font for cell text
font_size

Make text larger or smaller
guess_knitr_output_format

Guess knitr output format
fmt-numbers

Description for fmt_ functions
hux_logo

Huxtable logo
huxreg

Create a huxtable to display model output
huxtable-options

Package options
huxtable-package

Quick introduction to huxtable
insert_column

Insert a row or column
height

Set the table height
huxtable-FAQ

Frequently Asked Questions, including how to get help
huxtable

Create a huxtable
huxtable-news

Changes to the huxtable package
hux_prop_params

Shared documentation for huxtable property functions:
latex_float

Set the position of the table float in LaTeX
mapping-functions

How to set cell properties variably by cell contents
merge_across

Merge cells across rows or down columns
markdown

Interpret cell content as markdown
knit_print.data.frame

Print data frames in knitr using huxtable
jams

Prices of 3 jams
markdown-note

Note about markdown vs. print_md()
knit_print.huxtable

Print a huxtable within knitr
label

Set a table label for external referencing
mapping-params

Mapping parameters
padding

Cell padding
merge_repeated_rows

Merge repeated rows into multirow cells
na_string

Change how NA values are printed
position

Set the table's position with respect to surrounding content
number_format

Set how numbers are formatted in cells
quick-output

Quickly print objects to a PDF, TeX, Typst, HTML, Microsoft Office or RTF document, or PNG or SVG images
print.huxtable

Format and print huxtables using a default method
report_latex_dependencies

Manage LaTeX dependencies for huxtables
reexports

Objects exported from other packages
merge_cells

Merge a range of cells
set-outer

Set borders and padding around a rectangle of cells
set_contents

Set cell contents
row_height

Set the height of table rows
rowspecs

Different ways to select rows and columns
set_default_properties

Default huxtable properties
restack-across-down

Restack huxtables across/down the page
set-multiple

Set left, right, top and bottom properties
rtf_fc_tables

Create RTF font and color tables
rotation

Rotate text within cells
sanitize

Escape text for various formats
table_environment

Set the "table" environment in LaTeX
spans

Extend cells over multiple rows and/or columns
t.huxtable

Transpose a huxtable
span-overwrites-shadows

Section about colspan/rowspan
set_markdown_contents

Set cell contents, interpreting them as markdown
stripes

Set background color stripes
stripe

Return every n row or column numbers
split-across-down

Split a huxtable into multiple huxtables
style-functions

Set multiple properties on headers
[<-.brdr

Replace a subset of a brdr object
tidy_override

Change a model's tidy output
themes

Theme a huxtable
print_md

Create Markdown representing a huxtable
print_screen

Print a huxtable on screen
print_html

Create HTML representing a huxtable
print_typst

Create Typst markup representing a huxtable
tabular_environment

Set the table's tabular environment in LaTeX
text_color

Set the color of text in cells
wrap

Wrap cell content over multiple lines
print_rtf

Create RTF representing a huxtable
print_latex

Create LaTeX representing a huxtable
valign

Set the vertical alignment of cell content
width

Set the table width
add_rows

Insert one huxtable into another
as_huxtable

Convert objects to huxtables
add_footnote

Add a row with a footnote
as_Workbook

Convert a huxtable for Excel
add_colnames

Add column or row names
as_flextable

Convert a huxtable for Word/Powerpoint
bold

Make cell text bold or italic
background_color

Set cell background color
align

Set the horizontal alignment of cell content
left_border_color

Set border colors
left_border_style

Set border styles
by_function

Map cell contents to cell properties using a function or scale
brdr

Create a border object
by_colorspace

Map numeric cell contents smoothly to colors
by_ranges

Map numeric ranges to cell properties
left_border

Set borders
by_quantiles

Map numeric quantiles to cell properties
brdr_thickness

Get thickness of a brdr() object
by_regex

Map cells matching a string or regex to cell properties
by_cases

Map cell contents to properties using case_when