0

基于Flextable 示例,我想旋转第一列单元格中的文本(“Alive”、“Melanoma”、“Non-melanoma”):

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

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

4

0 回答 0