The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
?huxtable-FAQ
for workarounds.by_cases()
wasn’t picking up variables from the
caller environment.options(huxtable.quarto_process = TRUE)
.by_cases()
to work with dplyr 1.1.0. Within
by_cases()
formulas, .
is now vector rather
than matrix when dplyr version 1.1.0 is detected. Thanks @DavisVaughan.quick_*
functions. Thanks @reuning.quick_*
functions. Thanks
to @ceresek.@table-label
only work
with quarto labels.column_to_header()
function converts a column to
header rows. New as_hux()
method for
grouped_df
objects optionally converts groups to header
rows.stripe_rows()
and
stripe_columns()
.format
and ...
options to
fmt_percent()
to allow flexible formatting via
formatC()
.add_footnote()
gets an explicit
number_format
argument which is NA
by
default.to_screen()
.huxreg(..., error_pos = "right")
to flextable.New behaviour: setting colspan()
or
rowspan()
overwrites the content of cells that have been
shadowed.
<- hux(c(1, 1), c(2, 2), c(3, 3))
ht <- set_all_borders(ht)
ht colspan(ht)[1, 1] <- 3
# old behaviour
c(2, 1, 3)]
ht[, ## +--------------------------+
## | 2 |
## +--------+--------+--------+
## | 2 | 1 | 3 |
## +--------+--------+--------+
# new behaviour
c(2, 1, 3)]
ht[, ## +--------------------------+
## | 1 |
## +--------+--------+--------+
## | 2 | 1 | 3 |
## +--------+--------+--------+
New option huxtable.latex_siunitx_align
allows you
to use the LaTeX siunitx
package to handle decimal point
alignment. This is FALSE
by default.
Bugfix: centre alignment was not working in
print_screen()
.
Bugfix: failure in to_md()
with recent versions of
stringi
package.
Bugfix: repeating a single row in a subset, like
ht[c(1, 1, 2, 3), ]
, was setting colspan = 2
on the repeated row.
Bugfix: zero-argument subset replacement like
ht[] <- ...
wasn’t working.
align(ht) == "."
. This may change the appearance of some
documents.tidy_override()
to extend columns of
tidy
and glance
.^
was giving errors in LaTeX.table_environment
property so you can use
e.g. "table*"
in TeX.print_screen(h, colnames = FALSE)
didn’t print
a final newline.as_flextable()
now exports markdown in cells to RTF,
and to Word with the help of the optional ftExtra
package.
Thanks @atusy for
adding this feature.
Improvements to markdown screen export. This now uses the
optional fansi
package.
New feature: as_Workbook()
gains
start_row
and start_col
arguments, to write a
huxtable into an Excel worksheet starting at a particular row or
column.
New feature: huxreg()
gains a
glance_args
argument to pass arguments to
glance()
.
New feature: options(huxtable.long_minus = TRUE)
will try to use long minus signs before numbers. The default is
FALSE
. It will probably become TRUE
in a
future version.
Bugfix: insert_row/column(..., after = 0)
was
unsetting table properties.
Bugfix: unicode characters above 32767 were incorrectly represented in RTF. Thanks @kaigu1990.
Bugfix: columns were being collapsed in
as_Workbook()
.
Bugfix: style_cells
didn’t work unless huxtable was
on the search path.
Bugfix: merge_repeated_rows
merged NA
rows incorrectly.
Bugfix: number format was not set correctly in
huxreg()
’s note
.
Bugfix: in huxreg()
, tidy_args
threw an
error if the first argument to tidy()
was a named
list.
Bugfix: tidy_replace()
was broken.
Clearer error messages for tidy_override()
when
extend = FALSE
. In future, extend
will
probably default to TRUE
.
Huxtable 5.0.0 brings numerous changes. For a more user-friendly introduction, see https://hughjonesd.github.io/whats-new-in-huxtable-5.0.0.html.
There are changes to LaTeX output.
\tabcolsep
is now set to 0 within huxtable
tables, while left and right padding should now take effect even when
wrap
is FALSE
.width
is set. If width
is set, it is
“tabularx”.wrap
only matters if width
is set.
Otherwise, cell wrapping is off.\centerbox
macro from the LaTeX “adjustbox” package
is used to centre tables. This should improve centring when tables are
too wide. You may need to update the LaTeX “adjustbox” package to a
recent version. check_latex_dependencies()
can inform you
about this.As previously signalled, add_colnames
has now become
TRUE
by default in huxtable()
and
as_huxtable()
. Set
options(huxtable.add_colnames = FALSE)
to go back to the
old behaviour.
Newlines in cell contents are now respected (in LaTeX, so long as
wrap = TRUE
and width
has been set).
Huxtable borders have been reworked, fixing some longstanding bugs and adding new features.
Borders are now automatically collapsed. For example:
%>%
jams set_right_border(everywhere, 1, 1) %>%
set_left_border(everywhere, 2, 0.4)
will set the border in between the columns of jams
to
0.4
, overwriting the previous value. This is more in line
with what you would expect. For example, the following code now does
what you probably want:
jams %>%
set_rowspan(2, 1, 3) %>%
set_bottom_border(4, everywhere, 1)
## Type Price
## Strawberry 1.90
## 2.10
## 1.80
## ---------------------------
instead of the old behaviour:
jams %>%
set_rowspan(2, 1, 3) %>%
set_bottom_border(4, everywhere, 1)
## Type Price
## Strawberry 1.90
## 2.10
## 1.80
## -----------
set_left_border()
, set_all_borders()
and friends all use a default value of 0.4. So to set a default border,
write e.g.
as_hux(head(iris)) %>%
set_bottom_border(1, everywhere)
A new brdr()
class encapsulates border thickness,
style and colour. You can set all properties at once by writing,
e.g.:
as_hux(jams) %>%
set_bottom_border(1, everywhere, brdr(1, "dotted", "darkgreen"))
left_border(ht)
and friends return a brdr
object. To access the border thickness, write
brdr_thickness(left_border(ht))
.
Various deprecated items have been removed:
set_*
. Instead, use
map_*
.byrow
argument to set_*
. Instead, use
map_*
and by_cols()
.error_style
and pad_decimal
arguments in
huxreg
. Use error_format
and
align(hx) <- "."
.where()
, is_a_number()
and
pad_decimal()
functions. Use map_*
functions,
! is.na(as.numeric(x))
, and
align(ht) <- "."
.Default padding has been increased to 6 points.
By default, width()
is now unset.
By default, wrap()
is now
TRUE
.
every()
has been renamed to stripe()
,
to avoid a clash with purrr::every()
.
everywhere
, evens
and odds
are
still the same.
The little-used ability to set copy_cell_props
to a
character vector in rbind.huxtable
and
cbind.huxtable
has been removed. You can still set it to
FALSE
.
add_rows()
and add_columns()
now always
call rbind.huxtable()
or cbind.huxtable()
and
return a huxtable.
Huxtable no longer supports dplyr versions less than 0.7.0 (released mid-2017).
set_cell_properties()
has been renamed
style_cells()
. It is retained as a soft-deprecated
alias.
Various themes have been tweaked:
theme_basic()
now has bold headers and no header column
by default.theme_plain()
defaults to
position = "centre"
.theme_striped()
uses grey stripes, a white border, and
subtler headers.theme_article()
has thinner borders.You can now use markdown within table cells.
set_markdown(ht, rows, cols)
to turn this on.set_markdown_contents()
to set cell contents that will be interpreted as markdown.Huxtable now has the concept of header row and columns.
set_header_rows(ht, row_numbers, TRUE)
. For columns, use
header_cols()
or set_header_cols()
.style_headers()
,
style_header_cols()
, and style_header_rows()
to set multiple properties on headers.header_row/col = TRUE
set the first row/col
to a header, and style all header rows/cols.set_bold()
and set_italic()
now use a
default value of TRUE
. So you can write e.g.
as_hux(head(iris)) %>%
set_bold(1, everywhere)
Console output in R now shows table position and caption position.
By default, huxtable now sets labels from the current knitr chunk
label, if there is one. This is consistent with kable()
. In
bookdown, you can then do e.g.
Some iris species are shown in \@ref(tab:mytable):
```r
as_hux(iris)
```
Set options(huxtable.autolabel = FALSE)
to turn off this
behaviour.
The one-argument form of [
now works for huxtables
just as it does for data frames. For example, ht[2:3]
selects columns 2 and 3.
New functions fmt_percent()
and
fmt_pretty()
for passing into
number_format()
:
$Sugar <-c ("Sugar content", 0.4, 0.35, 0.45)
jamsset_number_format(jams, -1, "Sugar", fmt_percent(1))
split_across()
and split_down()
split a
huxtable into a list of sub-tables. Headers can be automatically
included.
restack_across()
and restack_down()
split a huxtable, then join it back up. This is useful for making a
table fit on a page.
merge_across()
and merge_down()
merge
an area of cells horizontally across rows, or vertically down
columns.
New functions
set_lr_borders()/_border_colors()/_border_styles()/_padding()
set left and right borders and padding simultaneously. New functions
set_tb_borders()
etc. set top and bottom properties
simultaneously. There are map_
equivalents of all of
these.
set_outer_padding()
sets padding around a range of
cells, similarly to set_outer_borders()
.
A new table-level property, caption_width()
, allows
you to set the width of the caption. The default, NA
, sets
the width equal to the table width.
There are two new themes: theme_compact()
and
theme_bright()
.
For huxreg()
, a new function
tidy_replace()
allows you to replace the output of
tidy(x)
entirely.
huxtable now only sets
options(huxtable.knit_print_df = TRUE)
if it is attached,
not if it is loaded.
huxtable supports dplyr::relocate()
, new in dplyr
1.0.0.
Improvements to as_flextable()
.
Improvements to quick_pptx()
(thanks @davidgohel).
Bugfixes for
options(huxtable.use_fontspec = TRUE)
.
Bugfix: add_rownames = "string"
now works as
promised.
Bugfix: non-ASCII characters are now supported in RTF.
New versions of the gtsummary
package will have an as_huxtable()
method.
Package texreg on CRAN
includes a huxtablereg()
function for creating a table of
regression outputs.
by_quantiles()
, by_equal_groups()
and
by_colorspace()
have gained a colwise
argument, which calculates quantiles or colors separately for each
column.as_flextable()
(thanks @sjewo).merge_repeated_rows()
function: merge repeated rows
into a single cell.fill
and colspan/rowspan
arguments for
insert_row()/insert_column()
:
insert_row(ht, "blah", "", "", "", "", ...)
can be
written insert_row(ht, "blah", fill = "")
.colspan/rowspan
set colspan/rowspan
of the
first cell in the inserted row/column.to_screen()
.options('huxtable.latex_use_fontspec')
to
TRUE
to use portable font names in TeX documents, with the
LaTeX “fontspec” package.hux_logo()
.row_height
correctly.quick_latex()
function.texreg
package now includes a
huxtablereg
function, analogous to huxreg
,
which outputs a huxtable from a list of regressions. This will be
available from the next version of texreg
.flextable
package
and recent versions of Pandoc. (Powerpoint printing requires Pandoc
>= 2.4.0.)position()
allow text wrapping around tables.set_outer_border_colors()
and
set_outer_border_styles()
functions, like
set_outer_borders()
.broom
package, instead
using the generics
package. If you use
huxreg()
, you will still need e.g. broom
or
broom.mixed
to provide tidy()
and
glance()
methods for specific models.tidy.tidy_override()
and
glance.tidy_override()
should work even if underlying
object has no tidy()
or glance()
method.echo = TRUE
in
Rmd pdf_document format.caption()
and height()
weren’t
playing nicely.mutate(..., copy_cell_props = FALSE)
was adding
a column named copy_cell_props
.check_latex_dependencies
and
install_latex_dependencies
gave misleading errors.stars
is NULL
in
huxreg
, don’t print a note by default.tinytex
when available, allowing
autoinstallation of latex packages.map_xxx
functions to set properties variably by
cell values.by_rows
,
by_values
, by_ranges
,
by_quantiles
etc.tidy_override
function to override p values etc. in
huxreg
.set_contents
function to change huxtable contents
within dplyr pipes.install_latex_dependencies()
or
tlmgr
if it is not already on your system.huxtable()
and friends,
add_rownames = "Colname"
now sets the name for the new
column.set_xxx
functions is deprecated,
as is the where
function. Use map_xxx
instead.byrow
is soft-deprecated. Use
by_cols()
instead.wrap=TRUE
caused squeezed text in RTF.TeX code was getting escaped by pandoc. To avoid this, if possible, huxtable now adds fenced code blocks round latex tables (see https://pandoc.org/MANUAL.html#extension-raw_attribute). You must add
md_extensions: +raw_attribute
to your YAML header for this to work, and you will need a recent (> 2.0.0) version of Pandoc.
print_rtf
, to_rtf
and
quick_rtf
functions.border_style
properties to set “solid”, “double”,
“dotted” or “dashed” borders. (At present, LaTeX only allows “solid” or
“double”.)merge_cells
function, an alternative interface to
colspan
and rowspan
.quick_pptx
function to print data frames and
huxtables into Powerpoint.install_latex_dependencies
and
check_latex_dependencies
utility functions.add_rows
and add_columns
now accept data
frames as arguments.theme_mondrian
theme :-Dprint_md
now handles bold
and italic cells.quick_pdf
has new width
and
height
options to change paper size.print_screen
and print_md
would
hang with a wide huxtable.tribble_hux
function wrapping
tibble::tribble()
for readable data input.add_rows
and add_columns
functions to
insert one or more rows into the middle of a huxtable.is_a_number
is deprecated.hux_logo()
;-)format
method which returns the result of
to_html
, to_latex
etc. as appropriate.to_html
printing e.g. “left-border: NA;” in
cell CSS.set_all_*
not working when huxtable is not
attached.as_Workbook
failing with non-numeric
width
.hux_logo
was using multiple fonts, fails with
Excel output.as_flextable
borders not working in cells with
colspan > 1.theme_plain
theme.add_colnames
is going to become
TRUE
. At present it remains FALSE
. Set
options("huxtable.add_colnames")
to TRUE
or
FALSE
to set the default and avoid warnings in future.quick_*
functions now automatically open documents if
used interactively. Use open = FALSE
to avoid.pad_decimal
is deprecated in favour of
align(ht) <- "."
.huxreg
continues with a warning if
statistics
are unavailable for some models.knit_print.data.frame
methods.
This means that bare data frames will be pretty-printed via huxtable if
the package is loaded.
options("huxtable.knit_print_df")
to
FALSE
if you don’t want this.theme_plain
theme. Set
options(“huxtable.knit_print_df_theme”) to a different one-argument
function if you want to use a different theme.autoformat
argument lets
huxtable()
and as_huxtable()
automatically
choose alignment and number format based on column type. Set
options("huxtable.autoformat")
to FALSE
to
turn off this feature by default.number_format
has changed from
“%5.3g” to “%.3g”, which no longer space-pads numbers.as_flextable
now does not print column names in the
header. This matches the standard huxtable behaviour whereby headers are
“just another row/column”. To get the old behaviour, use
colnames_to_header = TRUE
.add_colnames
.huxreg
was never using built-in confidence
intervals.number_format
,
huxreg
, as_hux.table
,
as_flextable
.openxlsx
package.quick_xlsx
function.set_*
column
specifications: e.g. set_bold(ht, 1:3, matches(“ab”), TRUE)after
argument to
insert_column
.quick_*
functions: when the file
argument
is not explicitly specified, confirm overwrites manually, or fail if
called non-interactively.tidy_args
argument to huxreg allows per-model
customization of the call to tidy
.quick_xxx
functions without an explicit
file
argument throw an error if called non-interactively,
and prompt before overwriting files if called interactively.number_format
to exponents in scientific
notation.quick_pdf
error when moving output across
filesystems.quick_html
, quick_pdf
and
quick_docx
functions to print table-like objects to a new
document.to_screen
only shows colnames if there are any
non-zero-length column names.number_format
now applies to any number-like substrings
in cells. This means you can include e.g. significance stars in a cell
and still use number_format
to format the content.number_format
is NA, numbers are unchanged.number_format
has changed from “%5.2f”
to “%5.3g”, which plays nicer with integers but may surprise you by
using scientific format for large numbers.outer_borders
argument for huxreg
.
This changes default behaviour slightly.border
argument for add_footnote
to
choose width of footnote’s top border.set_outer_borders
now accepts the same row/column
arguments as other set_
functions.align
, position
and
caption_pos
.huxreg
.set_outer_borders
function to set borders round a
rectangle of cells.to_screen
and to_md
now respect
wrap
and col_widths
properties.to_screen
and to_md
gain a
min_width
argument; to_md
gains a logical
header
argument; to_screen
gains a
compact
argument replacing blank = NULL
.crayon
package is installed. New huxtable.color_screen
option.ReporteRs
to officer
and
flextable
. No more RJava
horror.error_format
argument to huxreg
for
flexible control over uncertainty estimates.collapse
, borders
,
blank
and colname_color
from
to_screen
/print_screen
.as_FlexTable
is deprecated and calls
as_flextable
with a warning. header_rows
and
footer_rows
arguments are ignored. If you need this
feature, tell me.huxreg
:
ci_level
is NULL
by default. Set it to a
number to calculate confidence intervals.error_style
is deprecated with a warning in favour of
error_format
.{stars}
not %stars%
to display
significance levels in the note
argument.borders
becomes a number specifying border width. Set
to 0 for no borders.insert_row
and
insert_column
.latex_float
property allows you to change positioning
in LaTeX.caption_pos
.set_default_properties
function to set default
properties for new huxtables.huxreg
.huxreg
function to convert a list of models to a
huxtable.subset
, and filling in values by row.$<-
, [<-
and
[[<-
now work better.set_cell_properties
to set multiple
properties on cells.evens
, odds
, everywhere
,
every(n, from)
, final(n)
,
where(cond)
: convenience functions to select rows, columns
and cells.ReporteRs
.filter
and
select
.guess_knitr_output_format
.huxreg
.theme_minimal
has been renamed theme_basic
to avoid a name clash with ggplot2
.NEWS.md
file to track changes to the
package.These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.