huxtable (version 0.2.0)

font: Font

Description

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

Usage

font(ht)
font(ht) <- value
set_font(ht, row, col, value, byrow = FALSE)

Arguments

ht
A huxtable.
value
A character vector of font names. NB that LaTeX and HTML use different font names. 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 font, the font attribute. For set_font, the ht object.

See Also

Other formatting functions: background_color, bold, font_size, na_string, number_format, text_color

Examples

Run this code

ht <- huxtable(a = 1:3, b = 1:3)
font(ht) <-  'times'
font(ht)


ht <- huxtable(a = 1:3, b = 3:1)
ht2 <- set_font(ht, 'times')
font(ht2)
ht3 <- set_font(ht, 1:2, 1, 'times')
font(ht3)
ht4 <- set_font(ht, 1:2, 1:2, c('times', 'arial'), byrow = TRUE)
font(ht4)
ht5 <- set_font(ht, where(ht == 1), 'times')
font(ht5)

Run the code above in your browser using DataCamp Workspace