huxtable (version 0.2.2)

valign: 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.

Value

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

Details

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

Examples

Run this code

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


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

Run the code above in your browser using DataCamp Workspace