huxtable (version 1.0.0)

align: Alignment

Description

Functions to get or set the alignment property of huxtable table 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' 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.

Value

For align, the align attribute. For set_align, the ht object.

Examples

Run this code
# NOT RUN {
ht <- huxtable(a = 1:3, b = 1:3)
align(ht) <-  'right'
align(ht)


ht <- huxtable(a = 1:3, b = 3:1)
ht2 <- set_align(ht, 'right')
align(ht2)
ht3 <- set_align(ht, 1:2, 1, 'right')
align(ht3)
ht4 <- set_align(ht, 1:2, 1:2, c('right', 'left'), byrow = TRUE)
align(ht4)
ht5 <- set_align(ht, where(ht == 1), 'right')
align(ht5)
# }

Run the code above in your browser using DataLab