Learn R Programming

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

13,856

Version

5.5.7

License

MIT + file LICENSE

Last Published

October 1st, 2024

Functions in huxtable (5.5.7)

add_rows

Insert one huxtable into another
add_colnames

Add column or row names
brdr

Create a border object
brdr_thickness

Get thickness of a brdr() object
add_footnote

Add a row with a footnote
by_ranges

Map numeric ranges to cell properties
as_flextable

Convert a huxtable for Word/Powerpoint
col_width

Set the width of table columns
by_rows

Set cell properties by row or column
by_regex

Map cells matching a string or regex to cell properties
align

Set the horizontal alignment of cell content
border-styles

Set border styles
caption_width

Set the width of the table caption
column_to_header

Convert a column to header rows
guess_knitr_output_format

Guess knitr output format
cbind.huxtable

Combine rows or columns
header_cols

Mark rows or columns as headers
by_function

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

Map numeric quantiles to cell properties
borders

Set borders
by_values

Map specific cell values to cell properties
font

Set the font for cell text
caption

Set the table caption
bold

Make cell text bold or italic
mutate.huxtable

Use dplyr verbs with huxtable objects
[.huxtable

Subset a huxtable
escape_contents

Escape or unescape text in cells
border-colors

Set border colors
insert_column

Insert a row or column
by_cases

Map cell contents to properties using case_when
font_size

Make text larger or smaller
caption_pos

Position the table's caption
knit_print.data.frame

Print data frames in knitr using huxtable
huxtable-package

Quick introduction to huxtable
final

Return the last n rows or columns
jams

Prices of 3 jams
height

Set the table height
mapping-functions

How to set cell properties variably by cell contents
markdown

Interpret cell content as markdown
huxtable

Create a huxtable
knit_print.huxtable

Print a huxtable within knitr
label

Set a table label for external referencing
rotation

Rotate text within cells
merge_across

Merge cells across rows or down columns
by_colorspace

Map numeric cell contents smoothly to colors
fmt_percent

Format numbers as percent
latex_float

Set the position of the table float in LaTeX
set-outer

Set borders and padding around a rectangle of cells
fmt_pretty

Use prettyNum() to format numbers
merge_cells

Merge a range of cells
huxreg

Create a huxtable to display model output
report_latex_dependencies

Manage LaTeX dependencies for huxtables
position

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

Frequently Asked Questions, including how to get help
hux_logo

Huxtable logo
merge_repeated_rows

Merge repeated rows into multirow cells
row_height

Set the height of table rows
huxtable-news

Changes to the huxtable package
set_contents

Set cell contents
restack-across-down

Restack huxtables across/down the page
sanitize

Escape text for various formats
spans

Extend cells over multiple rows and/or columns
split-across-down

Split a huxtable into multiple huxtables
print.huxtable

Format and print huxtables using a default method
themes

Theme a huxtable
huxtable-options

Package options
na_string

Change how NA values are printed
tidy_override

Change a model's tidy output
quick-output

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

Create HTML representing a huxtable
reexports

Objects exported from other packages
print_latex

Create LaTeX representing a huxtable
set-multiple

Set left, right, top and bottom properties
print_screen

Print a huxtable on screen
number_format

Set how numbers are formatted in cells
padding

Set padding
stripe

Return every n row or column numbers
rowspecs

Different ways to select rows and columns
stripes

Set background color stripes
valign

Set the vertical alignment of cell content
tabular_environment

Set the table's tabular environment in LaTeX
text_color

Set the color of text in cells
style-functions

Set multiple properties on headers
rtf_fc_tables

Create RTF font and color tables
set_default_properties

Default huxtable properties
[<-.brdr

Replace a subset of a brdr object
width

Set the table width
wrap

Wrap cell content over multiple lines
set_markdown_contents

Set cell contents, interpreting them as markdown
t.huxtable

Transpose a huxtable
table_environment

Set the "table" environment in LaTeX
print_md

Create Markdown representing a huxtable
print_rtf

Create RTF representing a huxtable
as_huxtable

Convert objects to huxtables
background_color

Set cell background color
as_Workbook

Convert a huxtable for Excel