0th

Percentile

Functions to get or set the decimal padding property of huxtable table cells.

Usage
pad_decimal(ht)
set_pad_decimal(ht, row, col, value, byrow = FALSE)
Arguments
ht

A huxtable.

value

A vector of single characters. NA is the default of no padding. Set to NA to reset to the default.

row

A row specifier. See rowspecs for details.

col

An optional column specifier.

byrow

If TRUE, fill in values by row rather than by column.

Details

LaTeX and HTML both have no simple way to align columns on decimal points, especially when cells may contain non-mathematical content like significance stars. To right-pad cells in a column to align on the rightmost decimal point, set pad_decimal to '.' or whatever decimal you prefer to use. Note that this will only work for cells with align set to 'right'.

Value

For pad_decimal, the pad_decimal attribute. For set_pad_decimal, the ht object.

Examples
# NOT RUN {
vals <- c(1.00035, 22, "2.34 *", "(11.5 - 22.3)", "Do not pad this row.")
number_format(ht)       <- '%2.6g'
align(ht)[1:5,]         <- 'right'
ht

ht <- huxtable(a = 1:3, b = 3:1)