R: Text wrapping

wrap {huxtable} | R Documentation

## Text wrapping

### Description

Functions to get or set the text wrapping property of huxtable 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, which is `FALSE`.
`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` property. For `set_wrap`, the `ht` object.

### Examples

    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)

[Package huxtable version 4.2.0 Index]