I have a table to which I would like to apply background colours to individual cells. The colours have no obvious direct relationship with the data presented, and are specified in a separate data set.
How would I apply the background cell colours specified in:
set.seed(123)
colours2apply <- sample(x=c(rgb(1, 0, 0 ), rgb(1, 1, 0 ), rgb(0, 1, 1 )), 25, replace = T) %>%
matrix(nrow=5) %>%
data.frame()
> colours2apply
X1 X2 X3 X4 X5
1 #FF0000 #FF0000 #00FFFF #00FFFF #00FFFF
2 #00FFFF #FFFF00 #FFFF00 #FF0000 #00FFFF
3 #FFFF00 #00FFFF #00FFFF #FF0000 #FFFF00
4 #00FFFF #FFFF00 #FFFF00 #FF0000 #00FFFF
5 #00FFFF #FFFF00 #FF0000 #00FFFF #FFFF00
to a datatable like:
datatable(iris[1:5, 1:5])