left_padding {huxtable}R Documentation

Cell padding

Description

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

Usage

left_padding(ht)
left_padding(ht) <- value
set_left_padding(ht, row, col, value, byrow = FALSE)

right_padding(ht)
right_padding(ht) <- value
set_right_padding(ht, row, col, value, byrow = FALSE)

bottom_padding(ht)
bottom_padding(ht) <- value
set_bottom_padding(ht, row, col, value, byrow = FALSE)

top_padding(ht)
top_padding(ht) <- value
set_top_padding(ht, row, col, value, byrow = FALSE)

set_all_padding(ht, row, col, value, byrow = FALSE)

Arguments

ht

A huxtable.

row

A row specifier. See rowspecs for details.

col

An optional column specifier.

value

A vector or matrix. Characters must be valid CSS or LaTeX lengths. Numbers will be interpreted as lengths in points. Set to NA to reset to the default.

byrow

If TRUE, fill in values by row rather than by column.

Details

set_all_padding is a convenience function which sets left, right, top and bottom cell padding for the specified cells.

Value

For left_padding, the left_padding attribute. For set_left_padding, the ht object.

Similarly for the other functions.

Examples


ht <- huxtable(a = 1:3, b = 1:3)
left_padding(ht) <-  20
left_padding(ht)


ht <- huxtable(a = 1:3, b = 3:1)
ht2 <- set_left_padding(ht, 20)
left_padding(ht2)
ht3 <- set_left_padding(ht, 1:2, 1, 20)
left_padding(ht3)
ht4 <- set_left_padding(ht, 1:2, 1:2, c(20, 10), byrow = TRUE)
left_padding(ht4)
ht5 <- set_left_padding(ht, where(ht == 1), 20)
left_padding(ht5)
ht <- huxtable(a = 1:3, b = 1:3)
ht <- set_all_padding(ht, 1:3, 1:2, "20px")
left_padding(ht)
right_padding(ht)

[Package huxtable version 4.0.0 Index]