huxtable (version 4.6.1)

left_border_color: Border colors

Description

Functions to get or set the border colors property of huxtable cells.

Usage

left_border_color(ht)
left_border_color(ht) <- value
set_left_border_color(ht, row, col, value, byrow = FALSE)
map_left_border_color(ht, row, col, fn)

right_border_color(ht) right_border_color(ht) <- value set_right_border_color(ht, row, col, value, byrow = FALSE) map_right_border_color(ht, row, col, fn)

top_border_color(ht) top_border_color(ht) <- value set_top_border_color(ht, row, col, value, byrow = FALSE) map_top_border_color(ht, row, col, fn)

bottom_border_color(ht) bottom_border_color(ht) <- value set_bottom_border_color(ht, row, col, value, byrow = FALSE) map_bottom_border_color(ht, row, col, fn)

Arguments

ht

A huxtable.

value

A vector or matrix of colors.

Set to NA to reset to the default, which is NA.

row

A row specifier. See rowspecs for details.

col

An optional column specifier.

fn

A mapping function. See mapping-functions for details.

byrow

Deprecated. Use by_cols() instead.

Value

For left_border_color, the left_border_color property. For set_left_border_color and map_left_border_color, the modified huxtable.

Similarly for the other functions.

Details

Huxtable collapses borders and border colors. Right borders take priority over left borders, and top borders take priority over bottom borders.

See Also

set_all_border_colors()

Examples

Run this code
# NOT RUN {
ht <- huxtable(a = 1:3, b = 3:1)
ht <- set_all_borders(ht, 1)
set_left_border_color(ht, "red")
set_left_border_color(ht,
      1:2, 1, "red")

# 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
# }

Run the code above in your browser using DataCamp Workspace