我正在尝试使用 ReporteRs 包制作 FlexTable。我希望能够使用 cols.vertical 和 rows.vertical 灵活地指定每列和每行是否存在边界,对于所有 ncol()+ 1 列边界和所有 nrow() - 1 行边界。此外,我希望能够在表格边框的顶部和底部包含较暗的边框。下面显示了使用 mtcars 数据集的列规范示例,使用 iris 数据集的子集显示了较暗边框的示例。
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))