我已成功为单元格着色,但我还想在单元格 3 和 3 以及 8 和 9 之间画一条线。我该怎么做?
df <- data.frame(a=c(4,3,9,9),b=c(5,3,8,8))
## indices defining where the styles go
where <- rbind(c(2,1),c(2,2))
style <- rep(('background-color: orange'),2)
css.cell <- matrix('', nrow(df), ncol(df))
css.cell[where] <- style
library(htmlTable)
htmlTable(df, css.cell = css.cell)
我想要它像:
使用border-bottom
:
style <- rep(('background-color: orange; border-bottom: 2px solid;'), 2)
对于您的另一个问题:
df <- data.frame(a=c(4,3,9,9),b=c(5,3,8,8),c=c(5,6,7,8))
## indices defining where the styles go
where1 <- rbind(c(2,1),c(2,2))
style1 <- rep(('background-color: orange; border-bottom: 2px solid;'), 2)
where2 <- rbind(c(2,3))
style2 <- "border-bottom: 2px solid;"
css.cell <- matrix('', nrow(df), ncol(df))
css.cell[where1] <- style1
css.cell[where2] <- style2
library(htmlTable)
htmlTable(df, css.cell = css.cell)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句