gt_plot_bar_range: After gtExtras::gt_plot_bar_stack. The gt_plot_bar_range...

View source: R/gt_plot_bar_range.R

gt_plot_bar_rangeR Documentation

After gtExtras::gt_plot_bar_stack. The gt_plot_bar_range takes an existing gt_tbl object and converts the existing values into a stacked barchart.

Description

After gtExtras::gt_plot_bar_stack. The gt_plot_bar_range takes an existing gt_tbl object and converts the existing values into a stacked barchart.

Usage

gt_plot_bar_range(gt_object, column)

Arguments

gt_object

An existing gt table object of class gt_tbl

column

The column wherein the stacked barchart should replace existing data. Note that the data must be represented as a list of three numeric values and an optional color value ahead of time.

team_a_name

name of team A

team_b_name

name of team B

n_sim

number of simulations to run

seed

seed for reproducibility

Value

A list of two data frames: 1) win-win-draw probabilities and 2) result probabilities

Examples

## Not run: 
ex_df <- tibble(
x = c("load", "sumad", "spd", "hsrp", "tdc"),
list_data = list(c(75, 50, 75, "purple"), c(150, 50, 0, "blue"), c(0, 25, 175, "red"),
                 c(50, 100, 50, "orange"), c(50, 50, 100, "green"))
)

ex_tab <- ex_df %>%
  gt() %>%
  gt_plot_bar_range(column = list_data)

ex_tab

## End(Not run)

stxlen/soccr documentation built on Feb. 17, 2025, 1:23 a.m.