| left_border {huxtable} | R Documentation |
Functions to get or set the borders property of huxtable cells.
left_border(ht) left_border(ht) <- value set_left_border(ht, row, col, value, byrow = FALSE) right_border(ht) right_border(ht) <- value set_right_border(ht, row, col, value, byrow = FALSE) top_border(ht) top_border(ht) <- value set_top_border(ht, row, col, value, byrow = FALSE) bottom_border(ht) bottom_border(ht) <- value set_bottom_border(ht, row, col, value, byrow = FALSE)
ht |
A huxtable. |
value |
A numeric vector or matrix giving border widths in points. Set to 0 for no border. Set to |
row |
A row specifier. See |
col |
An optional column specifier. |
byrow |
If |
Currently in LaTeX, all non-zero border widths on a given line must be the same, and vertical border widths
can only be present (if value > 0) or absent.
For left_border, the left_border property.
For set_left_border, the ht object.
Similarly for the other functions.
huxtable currently sets borders on specific cells. This can lead to surprising behaviour when cells span multiple rows or columns: see the example. This behaviour may be improved in a future release.
ht <- huxtable(a = 1:3, b = 1:3) left_border(ht) <- 1 left_border(ht) print_screen(ht) ht <- huxtable(a = 1:3, b = 3:1) set_left_border(ht, 1) set_left_border(ht, 1:2, 1, 1) set_left_border(ht, 1:2, 1:2, c(1, 2), byrow = TRUE) set_left_border(ht, where(ht == 1), 1) # When cells span multiple rows: ht <- tribble_hux( ~Col1, ~Col2, "Cell 1,1 spans 2 rows", "Cell 1,2", "Cell 2,1 is invisible", "Cell 2,2" ) rowspan(ht)[1, 1] <- 2 ht bottom_border(ht)[2, ] <- 1 bottom_border_color(ht)[2, ] <- 'red' # Cell 1, 1 does not have a border set: ht # Fixed: bottom_border(ht)[1, 1] <- 1 bottom_border_color(ht)[1, 1] <- 'red' ht