我有这个数据框:
mydf <- data.frame(rowFactor1 = c(rep("S4",6),rep("S5",6),rep("S6",6)),
rowFactor2 = rep(c("All","T1/T2(V)"), 9),
colFactor1 = rep(c(rep("Ml",2),rep("Mp",2),rep("Mra",2)), 3),
x = c(
"8.73",
"0.46 / 8.28 ( 2 )",
"7.02",
"0.84 / 8.28 ( 3 )",
"0.55",
"0.90 / 1.20 ( 0 )",
"8.14",
"2.02 / 1.57 ( 5 )",
"0.55",
"2.90 / 1.28 ( 4 )",
"1.73",
"3.46 / 8.28 ( 6 )",
"6.02",
"0.87 / 8.90 ( 5 )",
"1.55",
"0.90 / 1.20 ( 1 )",
"6.24",
"2.02 / 1.57 ( 7 )"
))
如何使用 R 创建具有多行的Latex表mydf
?
我尝试使用tabular
R包的功能tables
tab1 <- tabular(Heading()*RowFactor(rowFactor1, spacing = 1,
c("S4","S5","S6"))*
Heading()*RowFactor(rowFactor2,
levelnames = c("All","T1/T2(V)")) ~
Heading()*Factor(colFactor1,
levelnames = c("Ml","Mp","Mra")),
data = mydf)
latex(tab1)
我有这张表没有 x 的值 ( 8.73, 0.46 / 8.28 ( 2 )
...) 并填充了单个值1
。
谢谢你的帮助 !