Learn R Programming

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

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 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 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.

Fund huxtable development

If you find huxtable useful, fund me on Patreon.

Copy Link

Version

Install

install.packages('huxtable')

Monthly Downloads

9,307

Version

5.1.1

License

MIT + file LICENSE

Maintainer

David Hugh-Jones

Last Published

October 27th, 2020

Functions in huxtable (5.1.1)

add_rows

Insert one huxtable into another.
align

Set the horizontal alignment of cell content
borders

Set borders
border-styles

Set border styles
background_color

Set cell background color
as_huxtable

Convert objects to huxtables
bold

Make cell text bold or italic
by_colorspace

Map numeric cell contents smoothly to colors
as_flextable

Convert a huxtable for Word/Powerpoint
by_cases

Map cell contents to properties using case_when
caption_width

Set the width of the table caption
as_Workbook

Convert a huxtable for Excel
add_colnames

Add column or row names
cbind.huxtable

Combine rows or columns
border-colors

Set border colors
brdr

Create a border object
brdr_thickness

by_regex

Map cells matching a string or regex to cell properties
by_rows

Set cell properties by row or column
by_ranges

Map numeric ranges to cell properties
add_footnote

Add a row with a footnote
by_quantiles

Map numeric quantiles to cell properties
by_function

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

Set the table caption
caption_pos

Position the table's caption
font_size

Make text larger or smaller
by_values

Map specific cell values to cell properties
col_width

Set the width of table columns
hux_logo

Huxtable logo
escape_contents

Escape or unescape text in cells
guess_knitr_output_format

Guess knitr output format
huxtable-FAQ

Frequently Asked Questions, including how to get help
huxtable-news

Changes to the huxtable package
[.huxtable

Subset a huxtable
mutate.huxtable

Use dplyr verbs with huxtable objects
huxreg

Create a huxtable to display model output
header_cols

Mark rows or columns as headers
height

Set the table height
insert_column

Insert a row or column
huxtable

Create a huxtable
final

Return the last n rows or columns
merge_cells

Merge a range of cells
fmt_pretty

Use prettyNum() to format numbers
font

Set the font for cell text
jams

Prices of 3 jams
merge_repeated_rows

Merge repeated rows into multirow cells
fmt_percent

Format numbers as percent
na_string

Change how NA values are printed
knit_print.huxtable

Print a huxtable within knitr
rotation

Rotate text within cells
restack-across-down

Restack huxtables across/down the page
markdown

Format cell content as markdown
merge_across

Merge cells across rows or down columns
rtf_fc_tables

Create RTF font and color tables
knit_print.data.frame

Print data frames in knitr using huxtable
set-outer

Set borders and padding around a rectangle of cells
set-multiple

Set left, right, top and bottom properties
padding

Set padding
position

Set the table's position with respect to surrounding content
huxtable-options

Package options
sanitize

Escape text for various formats
print.huxtable

Format and print huxtables using a default method
huxtable-package

Quick introduction to huxtable
mapping-functions

How to set cell properties variably by cell contents
latex_float

Set the position of the table float in LaTeX
reexports

Objects exported from other packages
quick-output

Quickly print objects to a PDF, TeX, HTML, Microsoft Office or RTF document
split-across-down

Split a huxtable into multiple huxtables
label

Set a table label for external referencing
stripe

Return every n row or column numbers
themes

Theme a huxtable
text_color

Set the color of text in cells
set_markdown_contents

Set cell contents to markdown
report_latex_dependencies

Manage LaTeX dependencies for huxtables
spans

Extend cells over multiple rows and/or columns
number_format

Set how numbers are formatted in cells
t.huxtable

Transpose a huxtable
tabular_environment

Set the table's tabular environment in LaTeX
valign

Set the vertical alignment of cell content
wrap

Wrap cell content over multiple lines
width

Set the table width
style-functions

Set multiple properties on headers
row_height

Set the height of table rows
rowspecs

Different ways to select rows and columns
[<-.brdr

Replace a subset of a brdr object
print_rtf

Create RTF representing a huxtable
set_contents

Set cell contents
tidy_override

Change a model's tidy output
print_html

Create HTML representing a huxtable
set_default_properties

Default huxtable properties
print_screen

Print a huxtable on screen
print_latex

Create LaTeX representing a huxtable
print_md

Create Markdown representing a huxtable