ReporteRs在单元格中旋转文本

时间:2017-06-16 11:47:51

标签: r reporters

构建于Flextable examples我想在第一列的单元格中旋转文本(" Alive"," Melanoma","非黑色素瘤& #34):

data = structure(list(Status = c("Alive", "Alive", "Alive", "Alive",
"Melanoma", "Melanoma", "Melanoma", "Melanoma", "Non-melanoma",
"Non-melanoma", "Non-melanoma", "Non-melanoma"), Gender = c("Female",
"Female", "Male", "Male", "Female", "Female", "Male", "Male",
"Female", "Female", "Male", "Male"), Ulceration = c("Absent",
"Present", "Absent", "Present", "Absent", "Present", "Absent",
"Present", "Absent", "Present", "Absent", "Present"), n = c(68L,
23L, 24L, 19L, 8L, 20L, 8L, 21L, 3L, 4L, 4L, 3L), Mean = c(1.693,
2.972, 1.468, 4.319, 2.139, 4.724, 3.266, 5.143, 1.667, 3.302,
2.42, 8.053), SD = c(2.004, 2.593, 1.719, 2.423, 1.184, 4.128,
4.681, 2.862, 1.141, 3.713, 2.499, 4.019)), class = "data.frame", .Names = c("Status",
"Gender", "Ulceration", "n", "Mean", "SD"), row.names = c(NA,
-12L))

MyFTable = FlexTable( data = data[ , c( "Status", "Gender", "Ulceration", "n", "Mean") ],
                      header.columns = FALSE )

MyFTable = spanFlexTableRows( MyFTable, j = "Status", runs = as.character( data$Status ) )
MyFTable = spanFlexTableRows( MyFTable, j = "Gender", runs = as.character( data$Gender ) )
MyFTable

从文档中我认为text.direction属性应该处理这个:

baseCellProp = cellProperties()
MyFTable[,1]=chprop( baseCellProp, text.direction="btlr")
MyFTable

还有其他方法吗? (或者有办法让这个工作吗?)

0 个答案:

没有答案