gt_merge_stack: Merge and stack text from two columns in 'gt' (variation on...

View source: R/gt_merge_stack.R

gt_merge_stackR Documentation

Merge and stack text from two columns in gt (variation on {gtExtras})

Description

A variation on the gtExtras::gt_merge_stack function that implements a horizontal rule parameter separating the top and bottom text and simplifies the requirements for the input variables. {gtExtras} was created by Thomas Mock and is available under an MIT License.

Usage

gt_merge_stack(
  gt_object,
  columns = c(1, 2),
  font_color = c("black", "grey"),
  ...,
  small_cap = FALSE,
  font_size = c(14, 10),
  font_weight = "bold",
  h_rule = FALSE
)

Arguments

gt_object

An existing gt table object of class gt_tbl

columns

Columns to stack, Default: c(1, 2)

font_color

Color(s) to use for stacked text. Default: c("black", "grey")

...

Arguments passed on to scales::col2hcl

h

Hue, [0, 360]

c

Chroma, [0, 100]

l

Luminance, [0, 100]

alpha

Alpha, [0, 1].

small_cap

a logical indicating whether to use 'small-cap' on the top line of text

font_size

a string of length 2 indicating the font-size in px of the top and bottom text

font_weight

a string of length 2 indicating the 'font-weight' of the top and bottom text. Must be one of 'bold', 'normal', 'lighter'

h_rule

Horizontal rule to separate top and bottom column text. If TRUE, use a 1px line with a 2px margin on top and bottom. If FALSE, include no horizontal rule. To create a custom rule, provide a <hr> thematic break tag or a <div> with css styling.


elipousson/birdseyeview documentation built on Sept. 26, 2022, 10:11 p.m.