A 3-way crosstab table with {gt} - Table Contest Submission

A 3-way crosstab table with {gt}

Authors: John D. Johnson
Affiliations: Marquette University Law School Lubar Center

Abstract: This script demonstrates how to use {gt} and tidyr::pivot_wider to easily build an elegant static HTML 3-way crosstab table--a style popular with public opinion researchers among others. It also showcases additional features of {gt} including different ways to format data, use markdown syntax to format explanatory text, and fill cell backgrounds.

I use a custom function to assign cell background colors using a continuous color palette based on the value of each individual cell.

Full Description:

Table Type: static-HTML
Submission Type: Single Table Example
Table: https://rpubs.com/jdjohn215/three-way-crosstab-table-with-gt
Repo: https://github.com/jdjohn215/2020-RStudio-Table-Contest
RStudio Cloud:
DT package used:
gt package used: true
reactable package used:
flextable package used:
huxtable package used:
kableExtra package used:
Other packages: