Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
因此,例如在下表中,我想为第三行设置背景颜色#D9654B。可以通过指定第三行或使其以 V1=="c" 为条件来完成
df <- tibble(V1=c("a","b","c"),V2=c(7:9)) df %>% gt()
提前致谢
用于tab_style针对特定单元格进行格式化
tab_style
df %>% gt() %>% tab_style( style = list( cell_fill(color = "#D9654B") ), locations = cells_body( columns = vars(V1, V2), # not needed if coloring all columns rows = 3) )
如果您喜欢指定V1更好的值,也可以使用rows = V1 == "c"
V1
rows = V1 == "c"