Jeffery Chen
Jeffery Chen

Reputation: 113

Different background colors in each cell R

I have a table look like this:

dt <- data.frame(name = c("A","B","C"),
                 color = c("#D2B48C","#D3D3D3","#CD853F"))

How could I show each background color at column dt$color?

Upvotes: 0

Views: 570

Answers (1)

Silence Dogood
Silence Dogood

Reputation: 3597

You can try with show_col function of scales package

DF <- data.frame(name = c("A","B","C"),
             color = c("#D2B48C","#D3D3D3","#CD853F"))

library(scales)              
scales::show_col(DF$color)

enter image description here

Upvotes: 2

Related Questions