huxtable (version 0.2.0)

wrap: Text wrapping

Description

Functions to get or set the text wrapping property of huxtable table cells.

Usage

wrap(ht)
wrap(ht) <- value
set_wrap(ht, row, col, value, byrow = FALSE)

Arguments

ht
A huxtable.
value
A logical vector or matrix. If TRUE, long cell contents will be wrapped into multiple lines. Set to NA for the default. 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.

Value

For wrap, the wrap attribute. For set_wrap, the ht object.

Examples

Run this code
ht <- huxtable(a = rep('Some long text', 2))
wrap(ht)[1,] <- TRUE
print_html(ht)

ht <- huxtable(a = 1:3, b = 3:1)
ht2 <- set_wrap(ht, TRUE)
wrap(ht2)
ht3 <- set_wrap(ht, 1:2, 1, TRUE)
wrap(ht3)
ht4 <- set_wrap(ht, 1:2, 1:2, c(TRUE, FALSE), byrow = TRUE)
wrap(ht4)
ht5 <- set_wrap(ht, where(ht == 1), TRUE)
wrap(ht5)

Run the code above in your browser using DataCamp Workspace