R: Alignment

align {huxtable} | R Documentation

## Alignment

### Description

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

### Usage

    align(ht)
    align(ht) <- value
    set_align(ht, row, col, value, byrow = FALSE)

### Arguments

`ht` | A huxtable.
`value` | A character vector or matrix which may be 'left', 'center', 'right' , `NA` or a single character. Set to `NA` to reset to the default, which is `"left"`.
`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

This sets the horizontal alignment of the cell. If `value` is a single character (e.g. a decimal point), then the cell is aligned on this character.

### Value

For `align`, the `align` property. For `set_align`, the `ht` object.

### Examples

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

    ht <- huxtable(a = 1:3, b = 3:1)
    set_align(ht, 'right')
    set_align(ht, 1:2, 1, 'right')
    set_align(ht, 1:2, 1:2, c('right', 'left'), byrow = TRUE)
    set_align(ht, where(ht == 1), 'right')

[Package huxtable version 4.2.0 Index]