我正在尝试用ReporteRs包做一个FlexTable。我希望能够使用cols.vertical和rows.vertical灵活地指定是否存在每个列和行的边框,所有ncol()+ 1列边框和所有nrow() -1行边框。此外,我希望能够包括在表格边框的顶部和底部的较暗的边框。下面使用mtcars数据集显示了列规范的示例,使用虹膜数据集的子集显示了较暗边框的示例。
library(ReporteRs)
a <- FlexTable(mtcars, body.cell.props = cellProperties(border.style = "none"))
cols.vertical <- c(2, 4, 5)
rows.horizontal <- c(3, 4, 7)
a[, cols.vertical] <- chprop(cellProperties(border.right.width = 1,
border.left.width=0,
border.top.width=0,
border.bottom.width=0))
a[rows.horizontal, ] <- chprop(cellProperties(border.right.width = 0,
border.left.width=0,
border.top.width=0,
border.bottom.width=1))
a[rows.horizontal, cols.vertical] <- chprop(cellProperties(border.right.width=1,
border.left.width=0,
border.top.width=0,
border.bottom.width=1))
b <- FlexTable(iris[1:10,], body.cell.props = cellProperties(border.style="none"))
b[1, ]<- chprop(cellProperties(border.right.width = 0,
border.left.width=0,
border.top.width=2,
border.bottom.width=0))
b[nrow(iris[1:10, ]), ] <- chprop(cellProperties(border.right.width = 0,
border.left.width=0,
border.top.width=0,
border.bottom.width=2))https://stackoverflow.com/questions/44551764
复制相似问题