I've created a color-coded table in R's gt package with conditional formatting. I would like to include something that will function as a legend to signify what the colors mean. For instance (for simplicity):
a <- c(1 , 3 , 5 , 9)
b <- c(1 , 2 , 6 , 10)
ab <- data.frame(a , b)
library(gt)
gt(ab) %>%
tab_style(style = list(cell_fill(color = '#E69F00') ,
cell_text(weight = 'bold')) ,
locations = cells_body(columns = vars(a) ,
rows = (a > b)))
This produces an example of the color-coded table. I'd like to have a notation in source notes or a location below the figures that that would reproduce the color and indicate in text that the colored cell meant that a was higher than b. Any help or referral appreciated!