R: Vertical alignment

valign {huxtable} | R Documentation

## Vertical alignment

### Description

Functions to get or set the vertical alignment property of huxtable table cells.

### Usage

    valign(ht)
    valign(ht) <- value
    set_valign(ht, row, col, value, byrow = FALSE)

### Arguments

`ht` | A huxtable.
`value` | A character vector or matrix which may be 'top', 'middle', 'bottom' or `NA`. 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

Vertical alignment may not work for short text in LaTeX. Defining row heights with `row_height` may help.

### Value

For `valign`, the `valign` attribute. For `set_valign`, the `ht` object.

### Examples

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

    ht <- huxtable(a = 1:3, b = 3:1)
    ht2 <- set_valign(ht, 'bottom')
    valign(ht2)
    ht3 <- set_valign(ht, 1:2, 1, 'bottom')
    valign(ht3)
    ht4 <- set_valign(ht, 1:2, 1:2, c('bottom', 'bottom'), byrow = TRUE)
    valign(ht4)
    ht5 <- set_valign(ht, where(ht == 1), 'bottom')
    valign(ht5)

[Package huxtable version 3.0.0 Index]