Learn R Programming

⚠️There's a newer version (5.6.0) of this package.Take me there.

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 standard R subsetting, or using dplyr.
  • Automatic formatting for knitr/rmarkdown 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.
  • Quick one-liners to print data frames into a new PDF, HTML page, RTF or Microsoft document.
  • 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 in HTML or PDF.

Copy Link

Version

Install

install.packages('huxtable')

Monthly Downloads

14,405

Version

5.5.3

License

MIT + file LICENSE

Maintainer

David Hugh-Jones

Last Published

December 9th, 2023

Functions in huxtable (5.5.3)

by_function

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

Map numeric quantiles to cell properties
by_colorspace

Map numeric cell contents smoothly to colors
border-styles

Set border styles
by_regex

Map cells matching a string or regex to cell properties
by_ranges

Map numeric ranges to cell properties
borders

Set borders
brdr

Create a border object
brdr_thickness

Get thickness of a brdr() object
caption_width

Set the width of the table caption
caption

Set the table caption
caption_pos

Position the table's caption
by_values

Map specific cell values to cell properties
by_rows

Set cell properties by row or column
height

Set the table height
col_width

Set the width of table columns
[.huxtable

Subset a huxtable
fmt_pretty

Use prettyNum() to format numbers
fmt_percent

Format numbers as percent
escape_contents

Escape or unescape text in cells
mutate.huxtable

Use dplyr verbs with huxtable objects
header_cols

Mark rows or columns as headers
column_to_header

Convert a column to header rows
font

Set the font for cell text
final

Return the last n rows or columns
cbind.huxtable

Combine rows or columns
guess_knitr_output_format

Guess knitr output format
font_size

Make text larger or smaller
hux_logo

Huxtable logo
huxreg

Create a huxtable to display model output
huxtable-FAQ

Frequently Asked Questions, including how to get help
knit_print.huxtable

Print a huxtable within knitr
jams

Prices of 3 jams
insert_column

Insert a row or column
huxtable-package

Quick introduction to huxtable
knit_print.data.frame

Print data frames in knitr using huxtable
huxtable-options

Package options
huxtable-news

Changes to the huxtable package
huxtable

Create a huxtable
number_format

Set how numbers are formatted in cells
padding

Set padding
na_string

Change how NA values are printed
merge_across

Merge cells across rows or down columns
latex_float

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

How to set cell properties variably by cell contents
markdown

Interpret cell content as markdown
label

Set a table label for external referencing
merge_cells

Merge a range of cells
merge_repeated_rows

Merge repeated rows into multirow cells
quick-output

Quickly print objects to a PDF, TeX, HTML, Microsoft Office or RTF document
position

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

Different ways to select rows and columns
rotation

Rotate text within cells
print.huxtable

Format and print huxtables using a default method
report_latex_dependencies

Manage LaTeX dependencies for huxtables
rtf_fc_tables

Create RTF font and color tables
row_height

Set the height of table rows
restack-across-down

Restack huxtables across/down the page
reexports

Objects exported from other packages
stripe

Return every n row or column numbers
set_default_properties

Default huxtable properties
set_markdown_contents

Set cell contents, interpreting them as markdown
tabular_environment

Set the table's tabular environment in LaTeX
spans

Extend cells over multiple rows and/or columns
themes

Theme a huxtable
set-multiple

Set left, right, top and bottom properties
style-functions

Set multiple properties on headers
split-across-down

Split a huxtable into multiple huxtables
sanitize

Escape text for various formats
set-outer

Set borders and padding around a rectangle of cells
set_contents

Set cell contents
stripes

Set background color stripes
t.huxtable

Transpose a huxtable
tidy_override

Change a model's tidy output
[<-.brdr

Replace a subset of a brdr object
table_environment

Set the "table" environment in LaTeX
print_screen

Print a huxtable on screen
print_md

Create Markdown representing a huxtable
print_rtf

Create RTF representing a huxtable
text_color

Set the color of text in cells
print_html

Create HTML representing a huxtable
valign

Set the vertical alignment of cell content
wrap

Wrap cell content over multiple lines
width

Set the table width
print_latex

Create LaTeX representing a huxtable
as_flextable

Convert a huxtable for Word/Powerpoint
bold

Make cell text bold or italic
add_rows

Insert one huxtable into another
align

Set the horizontal alignment of cell content
background_color

Set cell background color
as_Workbook

Convert a huxtable for Excel
add_footnote

Add a row with a footnote
add_colnames

Add column or row names
border-colors

Set border colors
as_huxtable

Convert objects to huxtables
by_cases

Map cell contents to properties using case_when